Merging Gradual Typing

被引:0
|
作者
Ye, Wenjia [1 ]
Oliveira, Bruno C.D.S. [1 ]
Toro, Matías [1 ]
机构
[1] The University of Hong Kong, Hong Kong
关键词
!text type='Java']Java[!/text] programming language - Model checking - Syntactics;
D O I
10.1145/3689734
中图分类号
学科分类号
摘要
Programming language mechanisms with a type-directed semantics are nowadays common and widely used. Such mechanisms include gradual typing, type classes, implicits and intersection types with a merge operator. While sharing common challenges in their design and having complementary strengths, type-directed mechanisms have been mostly independently studied. This paper studies a new calculus, called λM★, which combines two type-directed mechanisms: gradual typing and a merge operator based on intersection types. Gradual typing enables a smooth transition between dynamically and statically typed code, and is available in languages such as TypeScript or Flow. The merge operator generalizes record concatenation to allow merges of values of any two types. Recent work has shown that the merge operator enables modelling expressive OOP features like first-class traits/classes and dynamic inheritance with static type-checking. These features are not found in mainstream statically typed OOP languages, but they can be found in dynamically or gradually typed languages such as JavaScript or TypeScript. In λM★, by exploiting the complementary strengths of gradual typing and the merge operator, we obtain a foundation for modelling gradually typed languages with both first-class classes and dynamic inheritance. We study a static variant of λM★ (called λM); prove the type-soundness of λM★; show that λM★ can encode gradual rows and all well-typed terms in the GT FL calculus; and show that λM★ satisfies gradual typing criteria. The dynamic gradual guarantee (DGG) is challenging due to the possibility of ambiguity errors. We establish a variant of the DGG using a semantic notion of precision based on a step-indexed logical relation. © 2024 owner/author(s)
引用
收藏
相关论文
共 50 条
  • [1] Confined Gradual Typing
    Allende, Esteban
    Fabry, Johan
    Garcia, Ronald
    Tanter, Eric
    ACM SIGPLAN NOTICES, 2014, 49 (10) : 251 - 270
  • [2] Abstracting Gradual Typing
    Garcia, Ronald
    Clark, Alison M.
    Tanter, Eric
    ACM SIGPLAN NOTICES, 2016, 51 (01) : 429 - 442
  • [3] Gradual typing for generics
    Graduate School of Informatics, Kyoto University, Japan
    ACM SIGPLAN Not., 10 (609-624):
  • [4] Gradual Typing for Generics
    Ina, Lintaro
    Igarashi, Atsushi
    OOPSLA 11: PROCEEDINGS OF THE 2011 ACM INTERNATIONAL CONFERENCE ON OBJECT ORIENTED PROGRAMMING SYSTEMS LANGUAGES AND APPLICATIONS, 2011, : 609 - 624
  • [5] Gradual typing for Smalltalk
    Allende, Esteban
    Callau, Oscar
    Fabry, Johan
    Tanter, Eric
    Denker, Marcus
    SCIENCE OF COMPUTER PROGRAMMING, 2014, 96 : 52 - 69
  • [6] Confined gradual typing
    Allende, Esteban
    Fabry, Johan
    Garcia, Ronald
    Tanter, Éric
    1600, Association for Computing Machinery, 2 Penn Plaza, Suite 701, New York, NY 10121-0701, United States (49): : 251 - 270
  • [7] Gradual Typing for Generics
    Ina, Lintaro
    Igarashi, Atsushi
    ACM SIGPLAN NOTICES, 2011, 46 (10) : 609 - 624
  • [8] Gradual typing for objects
    Siek, Jeremy
    Taha, Walid
    ECOOP 2007 - OBJECT-ORIENTED PROGRAMMING, PROCEEDINGS, 2007, 4609 : 2 - +
  • [9] Abstracting Gradual Typing
    Garcia R.
    Clark A.M.
    Tanter E.
    ACM SIGPLAN Notices, 2016, 51 (01): : 429 - 442
  • [10] Gradual Typing Using Union Typing With Records
    Ramirez Pulido, Karla
    Luis Ortega-Arjona, Jorge
    Gonzalez Huesca, Lourdes del Carmen
    ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2020, 354 (354) : 171 - 186