A Gradual Interpretation of Union Types

被引:13
|
作者
Toro, Matias [1 ]
Tanter, Eric [1 ]
机构
[1] Univ Chile, Comp Sci Dept DCC, PLEIAD Lab, Santiago, Chile
来源
STATIC ANALYSIS (SAS 2017) | 2017年 / 10422卷
关键词
SYNTAX;
D O I
10.1007/978-3-319-66706-5_19
中图分类号
TP301 [理论、方法];
学科分类号
081202 ;
摘要
Union types allow to capture the possibility of a term to be of several possibly unrelated types. Traditional static approaches to union types are untagged and tagged unions, which present dual advantages in their use. Inspired by recent work on using abstract interpretation to understand gradual typing, we present a novel design for union types, called gradual union types. Gradual union types combine the advantages of tagged and untagged union types, backed by dynamic checks. Seen as a gradual typing discipline, gradual union types are restricted imprecise types that denote a finite number of static types. We apply the Abstracting Gradual Typing (AGT) methodology of Garcia et al. to derive the static and dynamic semantics of a language that supports both gradual unions and the traditional, totally-unknown type. We uncover that gradual unions interact with the unknown type in a way that mandates a stratified approach to AGT, relying on a composition of two distinct abstract interpretations in order to retain optimality. Thanks to the abstract interpretation framework, the resulting language is type safe and satisfies the refined criteria for gradual languages. We also show how to compile such a language to a threesome cast calculus, and prove that the compilation preserves the semantics and properties of the language.
引用
收藏
页码:382 / 404
页数:23
相关论文
共 50 条
  • [21] INTERSECTION AND UNION TYPES
    BARBANERA, F
    DEZANICIANCAGLINI, M
    [J]. LECTURE NOTES IN COMPUTER SCIENCE, 1991, 526 : 651 - 674
  • [22] Subtyping union types
    Vouillon, R
    [J]. COMPUTER SCIENCE LOGIC, PROCEEDINGS, 2004, 3210 : 415 - 429
  • [23] How to Evaluate Blame for Gradual Types, Part 2
    Lazarek, Lukas
    Greenman, Ben
    Felleisen, Matthias
    Dimoulas, Christos
    [J]. PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2023, 7 (ICFP): : 159 - 186
  • [24] Type Inference for Rank 2 Gradual Intersection Types
    Angelo, Pedro
    Florido, Mario
    [J]. TRENDS IN FUNCTIONAL PROGRAMMING, TFP 2019, 2020, 12053 : 84 - 120
  • [25] Elaborating Intersection and Union Types
    Dunfield, Joshua
    [J]. ACM SIGPLAN NOTICES, 2012, 47 (09) : 17 - 28
  • [26] Elaborating intersection and union types
    Dunfield, Joshua
    [J]. JOURNAL OF FUNCTIONAL PROGRAMMING, 2014, 24 (2-3) : 133 - 165
  • [27] IDEOLOGIES AND TYPES OF UNION ACTIVITY
    VIDAL, D
    [J]. SOCIOLOGIE DU TRAVAIL, 1968, 10 (02) : 190 - 211
  • [28] 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
  • [29] UNION STRATEGIES AND TYPES OF ORGANIZATION
    ADAM, G
    [J]. REVUE FRANCAISE DE SCIENCE POLITIQUE, 1966, 16 (05): : 845 - 868
  • [30] Towards a Logic for Union Types
    Stavrinos, Yiorgos
    Veneti, Anastasia
    [J]. FUNDAMENTA INFORMATICAE, 2012, 121 (1-4) : 275 - 302