Generic programming

Back to PastelSys

Generic programming is concerned with writing functions and classes in terms of unspecified types, requiring only that each unspecified type supports a prespecified set of syntactical constructs specific to that type. A set of such type-requirements is called a concept. Each generic function or a type can later be instantiated by binding each of its unspecified types to a concrete type, which might happen explicitly, as with types, or implicitly, as with functions (the types can be inferred from the function arguments).

The goal of generic programming is to create algorithms which work with the widest possible set of types, with the minimum number of requirements.

Most of Pastel is based on generic programming.

Learn more

Files

An aggregate file for generic programming.