Notice

The website of Tom Schrijvers has moved to http://people.cs.kuleuven.be/~tom.schrijvers. Please adjust any links you maintain as this copy will be taken down shortly.


The Implicit Calculus: A New Foundation for Generic Programming


C.d.S. Oliveira, Bruno and Schrijvers, Tom and Choi, Wontae and Lee, Wonchan and Li, Kwangkeun.
Programming Language Design and Implementation, 33th ACM SIGPLAN Conference, Proceedings.
Tip, Frank, eds.
ACM, 2012.

Abstract

Generic programming (GP) is an increasingly important trend in programming languages. Well-known GP mechanisms, such as type classes and the C++0x concepts proposal, usually combine two features: 1) a special type of interfaces; and 2) implicit instantiation of implementations of those interfaces. Scala implicits are a GP language mechanism, inspired by type classes, that break with the tradition of coupling implicit instantiation with a special type of interface. Instead, implicits provide only implicit instantiation, which is generalized to work for any types. This turns out to be quite powerful and useful to address many limitations that show up in other GP mechanisms. This paper synthesizes the key ideas of implicits formally in a minimal and general core calculus called the implicit calculus, and it shows how to build source languages supporting implicit instantiation on top of it. A novelty of the calculus is its support for partial resolution and higher-order rules (a feature that has been proposed before, but was never formalized or implemented). Ultimately, the implicit calculus provides a formal model of implicits, which can be used by language designers to study and inform implementations of similar mechanisms in their own languages.

BibTeX

@inproceedings{oliveira:2012:pldi,
  author = {C.d.S. Oliveira, Bruno and Schrijvers, Tom and Choi, Wontae and Lee, Wonchan and Li, Kwangkeun},
  editor = {Tip, Frank},
  booktitle = {Programming Language Design and Implementation, 33th ACM SIGPLAN Conference, Proceedings},
  title = {{The Implicit Calculus: A New Foundation for Generic Programming}},
  publisher = {ACM},
  year = {2012},
  url = {/Research/papers/pldi2012.pdf},
  abstract = {Generic programming (GP) is an increasingly important trend in
programming languages. Well-known GP mechanisms, such as type classes
and the C++0x concepts proposal, usually combine two features: 1) a special type of
interfaces; and 2) implicit instantiation of implementations of
those interfaces.

Scala implicits are a GP language mechanism, inspired by type
classes, that break with the tradition of coupling
implicit instantiation with a special type of interface. Instead,
implicits provide only implicit instantiation, which is generalized to
work for any types. 
This turns out to be quite
powerful and useful to address many limitations that show up in other
GP mechanisms.

This paper synthesizes the key ideas of implicits formally in a minimal
and general core calculus called the implicit calculus,
and it shows how to build source languages supporting implicit
instantiation on top of it. A novelty of the calculus is its support
for partial resolution and higher-order rules (a feature 
that has been proposed before, but was never formalized or implemented).
Ultimately, the implicit calculus provides a formal model of implicits, 
which can be used by language designers to 
study and inform implementations of similar mechanisms in their own languages.
  },
}