Practical Optional Types for Clojure
By Ambrose Bonnaire-Sergeant, Rowan Davies, Sam Tobin-Hochstadt. 2016
36 citations recorded by the source corpus.
Typed Clojure is an optional type system for Clojure, a dynamic language in the Lisp family that targets the JVM. Typed Clojure enables Clojure programmers to gain greater confidence in the correctness of their code via static type checking while remaining in the Clojure world, and has acquired significant adoption in the Clojure community. Typed Clojure repurposes Typed Racket's occurrence typing, an approach to statically reasoning about predicate tests, and also includes several new type system features to handle existing Clojure idioms. In this paper, we describe Typed Clojure and present these type system extensions, focusing on three features widely used in Clojure. First, multimethods provide extensible operations, and their Clojure semantics turns out to have a surprising synergy with the underlying occurrence typing framework. Second, Java interoperability is central to Clojure's mission but introduces challenges such as ubiquitous null; Typed Clojure handles Java interoperability while ensuring the absence of null-pointer exceptions in typed programs. Third, Clojure programmers idiomatically use immutable dictionaries for data structures; Typed Clojure handles this with multiple forms of heterogeneous dictionary types. We provide a formal model of the Typed Clojure type system incorporating these and other features, with a proof of soundness. Additionally, Typed Clojure is now in use by numerous corporations and developers working with Clojure, and we present a quantitative analysis on the use of type system features in two substantial code bases.
Subfields: Artificial Intelligence, Information Systems, Software, Software Engineering
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
In Artificial Intelligence
In Information Systems
In Software
In Software Engineering
Citations in the corpus
- Do Machine Learning Models Produce TypeScript Types that Type Check? (2023, background): “Over the past decade, gradual typing has proliferated, and there are now gradually typed versions of several mainstream languages [6, 7, 11, 14, 31, 33, 37, 48, 52].”
- Inference and Evolution of TypeScript Declaration Files (2017, background): “Other languages, such as typed dialects of Python [23,10], Scheme [21], Clojure [5], Ruby [12], and Flow for JavaScript[7], have similar challenges with types and cross-language library interoperability, though not (yet) at the same scale as TypeScript.”