Elaborating intersection and union types

被引:18
|
作者
Dunfield, Joshua [1 ,2 ]
机构
[1] Max Planck Inst Software Syst MPI SWS, Kaiserslautern, Germany
[2] Max Planck Inst Software Syst MPI SWS, Saarbrucken, Germany
关键词
ASSIGNMENT; INFERENCE; CALCULUS; MODEL;
D O I
10.1017/S0956796813000270
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Designing and implementing typed programming languages is hard. Every new type system feature requires extending the metatheory and implementation, which are often complicated and fragile. To ease this process, we would like to provide general mechanisms that subsume many different features. In modern type systems, parametric polymorphism is fundamental, but intersection polymorphism has gained little traction in programming languages. Most practical intersection type systems have supported only refinement intersections, which increase the expressiveness of types (more precise properties can be checked) without altering the expressiveness of terms; refinement intersections can simply be erased during compilation. In contrast, unrestricted intersections increase the expressiveness of terms, and can be used to encode diverse language features, promising an economy of both theory and implementation. We describe a foundation for compiling unrestricted intersection and union types: an elaboration type system that generates ordinary.-calculus terms. The key feature is a Forsythe-like merge construct. With this construct, not all reductions of the source program preserve types; however, we prove that ordinary call-by-value evaluation of the elaborated program corresponds to a type-preserving evaluation of the source program. We also describe a prototype implementation and applications of unrestricted intersections and unions: records, operator overloading, and simulating dynamic typing.
引用
收藏
页码:133 / 165
页数:33
相关论文
共 50 条
  • [1] Elaborating Intersection and Union Types
    Dunfield, Joshua
    [J]. ACM SIGPLAN NOTICES, 2012, 47 (09) : 17 - 28
  • [2] INTERSECTION AND UNION TYPES
    BARBANERA, F
    DEZANICIANCAGLINI, M
    [J]. LECTURE NOTES IN COMPUTER SCIENCE, 1991, 526 : 651 - 674
  • [3] Intersection and Union Types for chi
    van Bakel, Steffen
    [J]. ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2005, 136 : 203 - 227
  • [4] Isomorphism of intersection and union types
    Coppo, Mario
    Dezani-Ciancaglini, Mariangiola
    Margaria, Ines
    Zacchi, Maddalena
    [J]. MATHEMATICAL STRUCTURES IN COMPUTER SCIENCE, 2017, 27 (05) : 603 - 625
  • [5] A Realizability Interpretation for Intersection and Union Types
    Dougherty, Daniel J.
    de'Liguoro, Ugo
    Liquori, Luigi
    Stolze, Claude
    [J]. PROGRAMMING LANGUAGES AND SYSTEMS, APLAS 2016, 2016, 10017 : 187 - 205
  • [6] Gradual typing with union and intersection types
    Castagna, Giuseppe
    Lanvin, Victor
    [J]. Proceedings of the ACM on Programming Languages, 2017, 1 (ICFP):
  • [7] On Isomorphism of "Functional" Intersection and Union Types
    Coppo, Mario
    Dezani-Ciancaglini, Mariangiola
    Margaria, Ines
    Zacchi, Maddalena
    [J]. ELECTRONIC PROCEEDINGS IN THEORETICAL COMPUTER SCIENCE, 2015, (177): : 53 - 64
  • [8] The Duality of Classical Intersection and Union Types
    Downen, Paul
    Ariola, Zena M.
    Ghilezan, Silvia
    [J]. FUNDAMENTA INFORMATICAE, 2019, 170 (1-3) : 39 - 92
  • [9] Toward Isomorphism of Intersection and Union Types
    Coppo, Mario
    Dezani-Ciancaglini, Mariangiola
    Margaria, Ines
    Zacchi, Maddalena
    [J]. ELECTRONIC PROCEEDINGS IN THEORETICAL COMPUTER SCIENCE, 2013, (121): : 58 - 80
  • [10] INTERSECTION AND UNION TYPES - SYNTAX AND SEMANTICS
    BARBANERA, F
    DEZANICIANCAGLINI, M
    DELIGUORO, U
    [J]. INFORMATION AND COMPUTATION, 1995, 119 (02) : 202 - 230