Affiliation:
1. Kyoto University, Japan
2. National Institute of Informatics, Japan
Abstract
Garcia and Cimini study a type inference problem for the ITGL, an implicitly and gradually typed language with let-polymorphism, and develop a sound and complete inference algorithm for it. Soundness and completeness mean that, if the algorithm succeeds, the input term can be translated to a well-typed term of an explicitly typed blame calculus by cast insertion and vice versa. However, in general, there are many possible translations depending on how type variables that were left undecided by static type inference are instantiated with concrete static types. Worse, the translated terms may behave differently—some evaluate to values but others raise blame.
In this paper, we propose and formalize a new blame calculus λ
B
DTI
that avoids such divergence as an intermediate language for the ITGL. A main idea is to allow a term to contain type variables (that have not been instantiated during static type inference) and defer instantiation of these type variables to run time. We introduce
dynamic type inference
(DTI) into the semantics of λ
B
DTI
so that type variables are instantiated along reduction. The DTI-based semantics not only avoids the divergence described above but also is
sound and complete
with respect to the semantics of fully instantiated terms in the following sense: if the evaluation of a term succeeds (i.e., terminates with a value) in the DTI-based semantics, then there is a fully instantiated version of the term that also succeeds in the explicitly typed blame calculus and vice versa.
Finally, we prove the gradual guarantee, which is an important correctness criterion of a gradually typed language, for the ITGL.
Funder
Japan Science and Technology Agency
Japan Society for the Promotion of Science
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Cited by
11 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. SelfPiCo: Self-Guided Partial Code Execution with LLMs;Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis;2024-09-11
2. Space-Efficient Polymorphic Gradual Typing, Mostly Parametric;Proceedings of the ACM on Programming Languages;2024-06-20
3. Generating Python Type Annotations from Type Inference: How Far Are We?;ACM Transactions on Software Engineering and Methodology;2024-06-03
4. Type-Based Gradual Typing Performance Optimization;Proceedings of the ACM on Programming Languages;2024-01-05
5. Gradual Typing Performance, Micro Configurations and Macro Perspectives;Lecture Notes in Computer Science;2024