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 条
  • [21] Gradual Typing for Annotated Type Systems
    Thiemann, Peter
    Fennell, Luminous
    PROGRAMMING LANGUAGES AND SYSTEMS, 2014, 8410 : 47 - 66
  • [22] Gradual typing with union and intersection types
    Castagna G.
    Lanvin V.
    Proceedings of the ACM on Programming Languages, 2017, 1 (ICFP):
  • [23] Taming Type Annotations in Gradual Typing
    Campora, John Peter
    Chen, Sheng
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2020, 4 (04):
  • [24] Space-efficient gradual typing
    Herman D.
    Tomb A.
    Flanagan C.
    Higher-Order and Symbolic Computation, 2010, 23 (02) : 167 - 189
  • [25] Towards Gradual Multiparty Session Typing
    Jongmans, Sung-Shik
    PROCEEDINGS OF THE 37TH IEEE/ACM INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING, ASE 2022, 2022,
  • [26] Monotonic References for Efficient Gradual Typing
    Siek, Jeremy G.
    Vitousek, Michael M.
    Cimini, Matteo
    Tobin-Hochstadt, Sam
    Garcia, Ronald
    PROGRAMMING LANGUAGES AND SYSTEMS, 2015, 9032 : 432 - 456
  • [27] Design and Evaluation of Gradual Typing for Python']Python
    Vitousek, Michael M.
    Kent, Andrew M.
    Siek, Jeremy G.
    Baker, Jim
    ACM SIGPLAN NOTICES, 2015, 50 (02) : 45 - 56
  • [28] Method lookup simulation with a gradual typing language
    Allende, Esteban
    Fabry, Johan
    2012 31ST INTERNATIONAL CONFERENCE OF THE CHILEAN COMPUTER SCIENCE SOCIETY (SCCC 2012), 2012, : 1 - 8
  • [29] Sound gradual typing is nominally alive and well
    Muehlboeck F.
    Tate R.
    Proceedings of the ACM on Programming Languages, 2017, 1 (OOPSLA)
  • [30] Gradual Typing Embedded Securely in Java']JavaScript
    Swamy, Nikhil
    Fournet, Cedric
    Rastogi, Aseem
    Bhargavan, Karthikeyan
    Chen, Juan
    Strub, Pierre-Yves
    Bierman, Gavin
    ACM SIGPLAN NOTICES, 2014, 49 (01) : 425 - 437