Trust, but Verify: Two-Phase Typing for Dynamic Languages
Panagiotis Vekris, Benjamin Cosman, Ranjit Jhala

TL;DR
This paper introduces a two-phase typing framework for dynamic languages, combining flow-insensitive type checking with flow-sensitive refinement typing to handle value-based overloading and verify correctness.
Contribution
It proposes a novel two-phased approach that first assigns basic types and then refines them with logical predicates to ensure correctness in dynamic languages.
Findings
Effective handling of value-based overloading
Successful verification of casts using refinement types
Enhanced type safety in dynamic languages
Abstract
A key challenge when statically typing so-called dynamic languages is the ubiquity of value-based overloading, where a given function can dynamically reflect upon and behave according to the types of its arguments. Thus, to establish basic types, the analysis must reason precisely about values, but in the presence of higher-order functions and polymorphism, this reasoning itself can require basic types. In this paper we address this chicken-and-egg problem by introducing the framework of two-phased typing. The first "trust" phase performs classical, i.e. flow-, path- and value-insensitive type checking to assign basic types to various program expressions. When the check inevitably runs into "errors" due to value-insensitivity, it wraps problematic expressions with DEAD-casts, which explicate the trust obligations that must be discharged by the second phase. The second phase uses…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Formal Methods in Verification · Security and Verification in Computing
