Essential Language Support for Generic Programming

Jeremy Siek and Andrew Lumsdaine (2005). Essential Language Support for Generic Programming. In PLDI 2005.

Concepts are an essential language feature for generic programming in the large. Concepts allow for succinct expression of constraints on type parameters of generic algorithms, enable systematic organization of problem domain abstractions, and make generic algorithms easier to use. In this paper we present the design of a type system and semantics for concepts that is suitable for non-type-inferencing languages. Our design shares much in common with the type classes of Haskell, though our primary influence is from best practices in the C++ community, where concepts are used to document type requirements for templates in generic libraries. Concepts include a novel combination of associated types and same-type constraints that do not appear in type classes, but that are similar to nested types and type sharing in ML.

The concepts of the paper are very similar to Haskell's type classes (according to section two, the main difference is that type classes are designed to allow Hindley-Milner type inference) and the associated types seem to me to be filling a similar role as functional dependancies. In any case I found it interesting and generic programming is on topic.

LtU discussed a comparative of language support for generic programming in 2003.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Some people have proposed

Some people have proposed associated types as a replacement for functional dependencies.