Type-safe cast

被引:10
|
作者
Weirich, S [1 ]
机构
[1] Univ Penn, Philadelphia, PA 19104 USA
关键词
D O I
10.1017/S0956796804005179
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Comparing two types for equality is an essential ingredient for an implementation of dynamic types. Once equality has been established, it is safe to cast a value from one type to another. In a language with run-time type analysis, implementing such a procedure is fairly straightforward. Unfortunately, this naive implementation destructs and rebuilds the argument while iterating over its type structure. However, by using higher-order polymorphism, a casting function can treat its argument parametrically. We demonstrate this solution in two frameworks for ad-hoc polymorphism: intensional type analysis and Haskell type classes.
引用
收藏
页码:681 / 695
页数:15
相关论文
共 50 条
  • [1] Type-safe cast - Functional pearl
    Weirich, S
    [J]. ACM SIGPLAN NOTICES, 2000, 35 (09) : 58 - 67
  • [2] Type-safe casting
    Hsieh, Wilson C.
    Fiuczynski, Marc E.
    Pardyak, Przemyslaw
    Bershad, Brian N.
    [J]. Software - Practice and Experience, 1998, 28 (11): : 1245 - 1252
  • [3] Type-safe disks
    Sivathanu, Gopalan
    [J]. USENIX ASSOCIATION 7TH USENIX SYMPOSIUM ON OPERATING SYSTEMS DESIGN AND IMPLEMENTATION, 2006, : 15 - 28
  • [4] Type-safe update programming
    Erwig, Martin
    Ren, Deling
    [J]. 2003, Springer Verlag (2618):
  • [5] Type-safe method inlining
    Glew, N
    Palsberg, J
    [J]. ECOOP 2002 - OBJECT-ORIENTED PROGRAMMING, 2002, 2374 : 525 - 544
  • [6] Type-safe update programming
    Erwig, M
    Ren, D
    [J]. PROGRAMMING LANGUAGES AND SYSTEMS, 2003, 2618 : 269 - 283
  • [7] A type-safe database interface
    Villoing, Florian
    Briot, Emmanuel
    [J]. RELIABLE SOFTWARE TECHNOLOGIES - ADA-EUROPE 2008, 2008, 5026 : 144 - 157
  • [8] Type-safe multithreading in Cyclone
    Grossman, D
    [J]. ACM SIGPLAN NOTICES, 2003, 38 (03) : 13 - 25
  • [9] Type-Safe Modular Parsing
    Zhang, Haoyuan
    Li, Huang
    Oliveira, Bruno C. D. S.
    [J]. SLE'17: PROCEEDINGS OF THE 10TH ACM SIGPLAN INTERNATIONAL CONFERENCE ON SOFTWARE LANGUAGE ENGINEERING, 2017, : 2 - 13
  • [10] Type-safe method inlining
    Glew, N
    Palsberg, J
    [J]. SCIENCE OF COMPUTER PROGRAMMING, 2004, 52 (1-3) : 281 - 306