system d :: nested refinement types
Nested Refinements: A Logic for Duck Typing
Ravi Chugh, Patrick M. Rondon, and Ranjit Jhala
POPL 2012
[
.pdf
|
tech report
(arxiv)
|
.bib ]
Programs written in dynamic languages make heavy use of features ---
run-time type tests, value-indexed dictionaries, polymorphism, and
higher-order functions --- that are beyond the reach of type systems
that employ either purely syntactic or purely semantic reasoning.
We present a core calculus, System D, that merges these two modes of
reasoning into a single powerful mechanism of nested refinement types
wherein the typing relation is itself a predicate in the refinement logic.
System D coordinates SMT-based logical implication and syntactic subtyping
to automatically typecheck sophisticated dynamic language programs.
By coupling nested refinements with McCarthy's theory of finite maps,
System D can precisely reason about the interaction of higher-order
functions, polymorphism, and dictionaries.
The addition of type predicates to the refinement logic creates a
circularity that leads to unique technical challenges in the metatheory,
which we solve with a novel stratification
approach that we use to prove the soundness of System D.
Dependent Types for JavaScript
Ravi Chugh, David Herman, and Ranjit Jhala
Draft Under Review
[
.pdf
(arxiv) ]
We present Dependent JavaScript (DJS), a statically-typed dialect of the
imperative, object-oriented, dynamic language. DJS supports the particularly
challenging features such as run-time type-tests, higher-order functions,
extensible objects, prototype inheritance, and arrays through a combination
of nested refinement types, strong updates to the heap, and heap unrolling to
precisely track prototype hierarchies. With our implementation of DJS, we
demonstrate that the type system is expressive enough to reason about a variety
of tricky idioms found in small examples drawn from several sources, including
the popular book JavaScript: The Good Parts and the SunSpider benchmark suite.
type checkers
System !D + Dependent JavaScript
Thanks to the
Brown PLT
folks for their LambdaJS tools!