5 research outputs found
Using standard typing algorithms incrementally
Modern languages are equipped with static type checking/inference that helps programmers to keep a clean programming style and to reduce errors. However, the ever-growing size of programs and their continuous evolution require building fast and efficient analysers. A promising solution is incrementality, aiming at only re-typing the diffs, i.e. those parts of the program that change or are inserted, rather than the entire codebase. We propose an algorithmic schema that drives an incremental usage of existing, standard typing algorithms with no changes. Ours is a grey-box approach: just the shape of the input, that of the results and some domain-specific knowledge are needed to instantiate our schema. Here, we present the foundations of our approach and the conditions for its correctmess. We show it at work to derive two different incremental typing algorithms. The first type checks an imperative language to detect information flow and non-interference, and the second infers types for a functional language. We assessed our proposal on a prototypical imple- mentation of an incremental type checker. Our experiments show that using the type checker incrementally is (almost) always rewardin
Using Standard Typing Algorithms Incrementally
Modern languages are equipped with static type checking/inference that helps
programmers to keep a clean programming style and to reduce errors. However,
the ever-growing size of programs and their continuous evolution require
building fast and efficient analysers. A promising solution is incrementality,
so one only re-types those parts of the program that are new, rather than the
entire codebase. We propose an algorithmic schema driving the definition of an
incremental typing algorithm that exploits the existing, standard ones with no
changes. Ours is a grey-box approach, meaning that just the shape of the input,
that of the results and some domain-specific knowledge are needed to
instantiate our schema. Here, we present the foundations of our approach and we
show it at work to derive three different incremental typing algorithms. The
first two implement type checking and inference for a functional language. The
last one type-checks an imperative language to detect information flow and
non-interference. We assessed our proposal on a prototypical implementation of
an incremental type checker. Our experiments show that using the type checker
incrementally is (almost) always rewarding.Comment: corrected and updated; experimental results adde
Recommended from our members
Extending Type Inference to Variational Programs
Through the use of conditional compilation and related tools, many software projects can be used to generate a huge
number of related programs. The problem of typing such variational software is difficult. The brute-force strategy
of generating all variants and typing each one individually is (1) usually infeasible for efficiency reasons and (2)
produces results that do not map well to the underlying variational program. Recent research has focused mainly
on efficiency and addressed only the problem of type checking. In this work we tackle the more general problem of
variational type inference and introduce variational types to represent the result of typing a variational program. We
introduce the variational lambda calculus (VLC) as a formal foundation for research on typing variational programs.
We define a type system for VLC in which VLC expressions are mapped to correspondingly variational types. We
show that the type system is correct by proving that the typing of expressions is preserved over the process of
variation elimination, which eventually results in a plain lambda calculus expression and its corresponding type.
We identify a set of equivalence rules for variational types and prove that the type unification problem modulo these
equivalence rules is unitary and decidable; we also present a sound and complete unification algorithm. Based on
the unification algorithm, the variational type inference algorithm is an extension of algorithm W. We show that
it is sound and complete and computes principal types. We also consider the extension of VLC with sum types, a
necessary feature for supporting variational data types, and demonstrate that the previous theoretical results also
hold under this extension. Finally, we characterize the complexity of variational type inference and demonstrate the
efficiency gains over the brute-force strategy.This is an author's peer-reviewed final manuscript, as accepted by the publisher. The published article is copyrighted by the Association for Computing Machinery and can be found at: http://toplas.acm.org/.Keywords: variational type inference, variational types, variational lambda calculu