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 条
  • [31] Gradual Typing of Erlang Programs: A Wrangler Experience
    Sagonas, Konstantinos
    Luna, Daniel
    ERLANG '08: PROCEEDINGS OF THE 2008 SIGPLAN ERLANG WORKSHOP, 2008, : 73 - 81
  • [32] Label Dependent Lambda Calculus and Gradual Typing
    Fu, Weili
    Krause, Fabian
    Thiemann, Peter
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2021, 5 (OOPSLA):
  • [33] Collapsible Contracts: Fixing a Pathology of Gradual Typing
    Feltey, Daniel
    Greenman, Ben
    Scholliers, Christophe
    Findler, Robert Bruce
    St-Amour, Vincent
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2018, 2
  • [34] Gradual Typing for First-Class Classes
    Takikawa, Asumu
    Strickland, T. Stephen
    Dimoulas, Christos
    Tobin-Hochstadt, Sam
    Felleisen, Matthias
    ACM SIGPLAN NOTICES, 2012, 47 (10) : 793 - 810
  • [35] SliceType: fast gaze typing with a merging keyboard
    Benligiray, Burak
    Topal, Cihan
    Akinlar, Cuneyt
    JOURNAL ON MULTIMODAL USER INTERFACES, 2019, 13 (04) : 321 - 334
  • [36] SliceType: fast gaze typing with a merging keyboard
    Burak Benligiray
    Cihan Topal
    Cuneyt Akinlar
    Journal on Multimodal User Interfaces, 2019, 13 : 321 - 334
  • [37] Casts and Costs: Harmonizing Safety and Performance in Gradual Typing
    Campora, John Peter
    Chen, Sheng
    Walkingshaw, Eric
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2018, 2
  • [38] Type-Based Gradual Typing Performance Optimization
    Campora, John Peter
    Khan, Mohammad Wahiduzzaman
    Chen, Sheng
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL, 2024, 8 (POPL):
  • [39] Casts and Costs: Harmonizing Safety and Performance in Gradual Typing
    Campora, John Peter
    Chen, Sheng
    Walkingshaw, Eric
    PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES, 2018,
  • [40] Type-directed operational semantics for gradual typing
    Ye, Wenjia
    Oliveira, Bruno C. D. S.
    JOURNAL OF FUNCTIONAL PROGRAMMING, 2024, 34