Stepanov–Musser and other generic programming paradigms
Generic programming is defined in as follows, The "generic programming" paradigm is an approach to software decomposition whereby fundamental requirements on types are abstracted from across concrete examples of algorithms and data structures and formalized asfind
, sort
etc., a direct approach would implement each algorithm specifically for each data structure, giving combinations to implement. However, in the generic programming approach, each data structure returns a model of an iterator concept (a simple value type that can be dereferenced to retrieve the current value, or changed to point to another value in the sequence) and each algorithm is instead written generically with arguments of such iterators, e.g. a pair of iterators pointing to the beginning and end of the subsequence or ''range'' to process. Thus, only data structure-algorithm combinations need be implemented. Several iterator concepts are specified in the STL, each a refinement of more restrictive concepts e.g. forward iterators only provide movement to the next value in a sequence (e.g. suitable for a singly linked list or a stream of input data), whereas a random-access iterator also provides direct constant-time access to any element of the sequence (e.g. suitable for a vector). An important point is that a data structure will return a model of the most general concept that can be implemented efficiently—Programming language support for genericity
Genericity facilities have existed in high-level languages since at least the 1970s in languages such as ML, CLU andIn object-oriented languages
When creating container classes in statically typed languages, it is inconvenient to write specific implementations for each datatype contained, especially if the code for each datatype is virtually identical. For example, in C++, this duplication of code can be circumvented by defining a class template:T
is a placeholder for whatever type is specified when the list is created. These "containers-of-type-T", commonly called templates, allow a class to be reused with different datatypes as long as certain contracts such as subtypes and Moving_Object
containing objects of type Animal
and Car
. Templates can also be used for type-independent functions as in the Swap
example below:
template
construct used above is widely cited as the genericity construct that popularized the notion among programmers and language designers and supports many generic programming idioms. The D programming language also offers fully generic-capable templates based on the C++ precedent but with a simplified syntax. The Java programming language has provided genericity facilities syntactically based on C++'s since the introduction of J2SE 5.0.
C# 2.0, Oxygene 1.5 (also known as Chrome) and Visual Basic .NET 2005 have constructs that take advantage of the support for generics present in the Microsoft .NET Framework since version 2.0.
Generics in Ada
=Example
= The specification of a generic package:=Advantages and limitations
= The language syntax allows precise specification of constraints on generic formal parameters. For example, it is possible to specify that a generic formal type will only accept a modular type as the actual. It is also possible to express constraints ''between'' generic formal parameters; for example:Templates in C++
C++ uses templates to enable generic programming techniques. The C++ Standard Library includes the Standard Template Library or STL that provides a framework of templates for common data structures and algorithms. Templates in C++ may also be used for template metaprogramming, which is a way of pre-evaluating some of the code at compile-time rather than run-time. Using template specialization, C++ Templates are considered=Technical overview
= There are many kinds of templates, the most common being function templates and class templates. A ''function template'' is a pattern for creating ordinary functions based upon the parameterizing types supplied when instantiated. For example, the C++ Standard Template Library contains the function templatemax(x, y)
that creates functions that return either ''x'' or ''y,'' whichever is larger. max()
could be defined like this:
max
and determines that this is a call to max(int, int)
. It then instantiates a version of the function where the parameterizing type T
is int
, making the equivalent of the following function:
x
and y
are integers, strings, or any other type for which the expression x < y
is sensible, or more specifically, for any type for which operator<
is defined. Common inheritance is not needed for the set of types that can be used, and so it is very similar to duck typing. A program defining a custom data type can use operator overloading to define the meaning of <
for that type, thus allowing its use with the max()
function template. While this may seem a minor benefit in this isolated example, in the context of a comprehensive library like the STL it allows the programmer to get extensive functionality for a new data type, just by defining a few operators for it. Merely defining <
allows a type to be used with the standard sort()
, stable_sort()
, and binary_search()
algorithms or to be put inside data structures such as set
s, heaps, and complex
does not define the <
operator, because there is no strict order on max(x, y)
will fail with a compile error, if ''x'' and ''y'' are complex
values. Likewise, other templates that rely on <
cannot be applied to complex
data unless a comparison (in the form of a functor or function) is provided. E.g.: A complex
cannot be used as key for a map
unless a comparison is provided. Unfortunately, compilers historically generate somewhat esoteric, long, and unhelpful error messages for this sort of error. Ensuring that a certain object adheres to a method protocol can alleviate this issue. Languages which use compare
instead of <
can also use complex
values as keys.
Another kind of template, a ''class template,'' extends the same concept to classes. A class template specialization is a class. Class templates are often used to make generic containers. For example, the STL has a list<int>
. A list of strings is denoted list<string>
. A list
has a set of standard functions associated with it, that work for any compatible parameterizing types.
=Template specialization
= A powerful feature of C++'s templates is ''template specialization''. This allows alternative implementations to be provided based on certain characteristics of the parameterized type that is being instantiated. Template specialization has two purposes: to allow certain forms of optimization, and to reduce code bloat. For example, consider asort()
template function. One of the primary activities that such a function does is to swap or exchange the values in two of the container's positions. If the values are large (in terms of the number of bytes it takes to store each of them), then it is often quicker to first build a separate list of pointers to the objects, sort those pointers, and then build the final sorted sequence. If the values are quite small however it is usually fastest to just swap the values in-place as needed. Furthermore, if the parameterized type is already of some pointer-type, then there is no need to build a separate pointer array. Template specialization allows the template creator to write different implementations and to specify the characteristics that the parameterized type(s) must have for each implementation to be used.
Unlike function templates, class templates can be partially specialized. That means that an alternate version of the class template code can be provided when some of the template parameters are known, while leaving other template parameters generic. This can be used, for example, to create a default implementation (the ''primary specialization'') that assumes that copying a parameterizing type is expensive and then create partial specializations for types that are cheap to copy, thus increasing overall efficiency. Clients of such a class template just use specializations of it without needing to know whether the compiler used the primary specialization or some partial specialization in each case. Class templates can also be ''fully specialized,'' which means that an alternate implementation can be provided when all of the parameterizing types are known.
=Advantages and disadvantages
= Some uses of templates, such as themax()
function, were previously filled by function-like Templates in D
Thestatic if
statement provide an alternative to respectively C++'s C++ concepts and if constexpr
.
* The is(...)
expression allows speculative instantiation to verify an object's traits at compile time.
* The auto
keyword and the typeof
typeof, alternately also typeOf, and TypeOf, is an operator provided by several programming languages to determine the data type of a variable. This is useful when constructing programs that must accept multiple types of data without explicitly s ...
expression allow Template
),
D uses an exclamation sign and parentheses: Template!(param1, param2)
.
This avoids the C++ parsing difficulties due to ambiguity with comparison operators.
If there is only one parameter, the parentheses can be omitted.
Conventionally, D combines the above features to provide isInputRange
, which is defined as follows:
=Code generation
= In addition to template metaprogramming, D also provides several features to enable compile-time code generation: * Theimport
expression allows reading a file from disk and using its contents as a string expression.
* Compile-time reflection allows enumerating and inspecting declarations and their members during compilation.
* User-defined import
expression and compile-time function execution also allow efficiently implementing Genericity in Eiffel
Generic classes have been a part of Eiffel since the original method and language design. The foundation publications of Eiffel, use the term ''genericity'' to describe the creation and use of generic classes.=Basic/Unconstrained genericity
= Generic classes are declared with their class name and a list of one or more ''formal generic parameters''. In the following code, classLIST
has one formal generic parameter G
ACCOUNT
and DEPOSIT
are other class names. ACCOUNT
and DEPOSIT
are considered ''actual generic parameters'' as they provide real class names to substitute for G
in actual use.
LIST /code> is considered a class, it is not considered a type. However, a generic derivation of LIST /code> such as LIST CCOUNT/code> is considered a type.
=Constrained genericity
=
For the list class shown above, an actual generic parameter substituting for G
can be any other available class. To constrain the set of classes from which valid actual generic parameters can be chosen, a ''generic constraint'' can be specified. In the declaration of class SORTED_LIST
below, the generic constraint dictates that any valid actual generic parameter will be a class that inherits from class COMPARABLE
. The generic constraint ensures that elements of a SORTED_LIST
can in fact be sorted.
class
SORTED_LIST COMPARABLE"> -> COMPARABLE
Generics in Java
Support for the ''generics'', or "containers-of-type-T" was added to the Java programming language
Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers ''write once, run anywh ...
in 2004 as part of J2SE 5.0. In Java, generics are only checked at compile time for type correctness. The generic type information is then removed via a process called type erasure In programming languages, type erasure is the load-time process by which explicit type annotations are removed from a program, before it is executed at run-time. Operational semantics that do not require programs to be accompanied by types are c ...
, to maintain compatibility with old JVM implementations, making it unavailable at runtime. For example, a List<String>
is converted to the raw type List
. The compiler inserts type casts to convert the elements to the String
type when they are retrieved from the list, reducing performance compared to other implementations such as C++ templates.
Genericity in .NET #, VB.NET/h3>
Generics were added as part of .NET Framework 2.0
Microsoft started development on the .NET Framework in the late 1990s originally under the name of Next Generation Windows Services (NGWS). By late 2001 the first beta versions of .NET 1.0 were released. The first version of .NET Framework was ...
in November 2005, based on a research prototype from Microsoft Research started in 1999. Although similar to generics in Java, .NET generics do not apply type erasure In programming languages, type erasure is the load-time process by which explicit type annotations are removed from a program, before it is executed at run-time. Operational semantics that do not require programs to be accompanied by types are c ...
, but implement generics as a first class mechanism in the runtime using reification. This design choice provides additional functionality, such as allowing reflection Reflection or reflexion may refer to:
Science and technology
* Reflection (physics), a common wave phenomenon
** Specular reflection, reflection from a smooth surface
*** Mirror image, a reflection in a mirror or in water
** Signal reflection, in ...
with preservation of generic types, as well as alleviating some of the limitations of erasure (such as being unable to create generic arrays). This also means that there is no performance hit from runtime casts and normally expensive boxing conversions. When primitive and value types are used as generic arguments, they get specialized implementations, allowing for efficient generic collections
Collection or Collections may refer to:
* Cash collection, the function of an accounts receivable department
* Collection (church), money donated by the congregation during a church service
* Collection agency, agency to collect cash
* Collection ...
and methods. As in C++ and Java, nested generic types such as Dictionary> are valid types, however are advised against for member signatures in code analysis design rules.
.NET allows six varieties of generic type constraints using the where
keyword including restricting generic types to be value types, to be classes, to have constructors, and to implement interfaces. Below is an example with an interface constraint:
using System;
class Sample
The MakeAtLeast()
method allows operation on arrays, with elements of generic type T
. The method's type constraint indicates that the method is applicable to any type T
that implements the generic IComparable<T>
interface. This ensures a compile time
In computer science, compile time (or compile-time) describes the time window during which a computer program is compiled.
The term is used as an adjective to describe concepts related to the context of program compilation, as opposed to concept ...
error, if the method is called if the type does not support comparison. The interface provides the generic method CompareTo(T)
.
The above method could also be written without generic types, simply using the non-generic Array
type. However, since arrays are contravariant, the casting would not be type safe
In computer science, type safety and type soundness are the extent to which a programming language discourages or prevents type errors. Type safety is sometimes alternatively considered to be a property of facilities of a computer language; that is ...
, and the compiler would be unable to find certain possible errors that would otherwise be caught when using generic types. In addition, the method would need to access the array items as object
s instead, and would require casting
Casting is a manufacturing process in which a liquid material is usually poured into a mold, which contains a hollow cavity of the desired shape, and then allowed to solidify. The solidified part is also known as a ''casting'', which is ejected ...
to compare two elements. (For value types like types such as int
this requires a boxing
Boxing (also known as "Western boxing" or "pugilism") is a combat sport in which two people, usually wearing protective gloves and other protective equipment such as hand wraps and mouthguards, throw punches at each other for a predetermined ...
conversion, although this can be worked around using the Comparer<T>
class, as is done in the standard collection classes.)
A notable behavior of static members in a generic .NET class is static member instantiation per run-time type (see example below).
//A generic class
public class GenTest
//a class
public class CountedInstances
//main code entry point
//at the end of execution, CountedInstances.Counter = 2
GenTest g1 = new GenTest(1);
GenTest g11 = new GenTest(11);
GenTest g111 = new GenTest(111);
GenTest g2 = new GenTest(1.0);
Genericity in Delphi
Delphi's Object Pascal dialect acquired generics in the Delphi 2007 release, initially only with the (now discontinued) .NET compiler before being added to the native code in the Delphi 2009 release. The semantics and capabilities of Delphi generics are largely modelled on those had by generics in .NET 2.0, though the implementation is by necessity quite different. Here's a more or less direct translation of the first C# example shown above:
program Sample;
uses
Generics.Defaults; //for IComparer<>
type
TUtils = class
class procedure MakeAtLeast(Arr: TArray; const Lowest: T;
Comparer: IComparer); overload;
class procedure MakeAtLeast(Arr: TArray; const Lowest: T); overload;
end;
class procedure TUtils.MakeAtLeast(Arr: TArray; const Lowest: T;
Comparer: IComparer);
var
I: Integer;
begin
if Comparer = nil then Comparer := TComparer.Default;
for I := Low(Arr) to High(Arr) do
if Comparer.Compare(Arr Lowest) < 0 then
Arr := Lowest;
end;
class procedure TUtils.MakeAtLeast(Arr: TArray; const Lowest: T);
begin
MakeAtLeast(Arr, Lowest, nil);
end;
var
Ints: TArray;
Value: Integer;
begin
Ints := TArray.Create(0, 1, 2, 3);
TUtils.MakeAtLeast(Ints, 2);
for Value in Ints do
WriteLn(Value);
ReadLn;
end.
As with C#, methods as well as whole types can have one or more type parameters. In the example, TArray is a generic type (defined by the language) and MakeAtLeast a generic method. The available constraints are very similar to the available constraints in C#: any value type, any class, a specific class or interface, and a class with a parameterless constructor. Multiple constraints act as an additive union.
Genericity in Free Pascal
Free Pascal
Free Pascal Compiler (FPC) is a compiler for the closely related programming-language dialects Pascal and Object Pascal. It is free software released under the GNU General Public License, witexception clausesthat allow static linking against it ...
implemented generics before Delphi, and with different syntax and semantics. However, since FPC version 2.6.0, the Delphi-style syntax is available when using the language mode. Thus, Free Pascal programmers are able to use generics in whichever style they prefer.
Delphi and Free Pascal example:
// Delphi style
unit A;
interface
type
TGenericClass = class
function Foo(const AValue: T): T;
end;
implementation
function TGenericClass.Foo(const AValue: T): T;
begin
Result := AValue + AValue;
end;
end.
// Free Pascal's ObjFPC style
unit B;
interface
type
generic TGenericClass = class
function Foo(const AValue: T): T;
end;
implementation
function TGenericClass.Foo(const AValue: T): T;
begin
Result := AValue + AValue;
end;
end.
// example usage, Delphi style
program TestGenDelphi;
uses
A,B;
var
GC1: A.TGenericClass;
GC2: B.TGenericClass;
begin
GC1 := A.TGenericClass.Create;
GC2 := B.TGenericClass.Create;
WriteLn(GC1.Foo(100)); // 200
WriteLn(GC2.Foo('hello')); // hellohello
GC1.Free;
GC2.Free;
end.
// example usage, ObjFPC style
program TestGenDelphi;
uses
A,B;
// required in ObjFPC
type
TAGenericClassInt = specialize A.TGenericClass;
TBGenericClassString = specialize B.TGenericClass;
var
GC1: TAGenericClassInt;
GC2: TBGenericClassString;
begin
GC1 := TAGenericClassInt.Create;
GC2 := TBGenericClassString.Create;
WriteLn(GC1.Foo(100)); // 200
WriteLn(GC2.Foo('hello')); // hellohello
GC1.Free;
GC2.Free;
end.
Functional languages
Genericity in Haskell
The type class
In computer science, a type class is a type system construct that supports ad hoc polymorphism. This is achieved by adding constraints to type variables in parametrically polymorphic types. Such a constraint typically involves a type class T and ...
mechanism of Haskell supports generic programming.
Six of the predefined type classes in Haskell (including Eq
, the types that can be compared for equality, and Show
, the types whose values can be rendered as strings) have the special property of supporting ''derived instances.'' This means that a programmer defining a new type can state that this type is to be an instance of one of these special type classes, without providing implementations of the class methods as is usually necessary when declaring class instances. All the necessary methods will be "derived" – that is, constructed automatically – based on the structure of the type.
For instance, the following declaration of a type of binary tree
In computer science, a binary tree is a k-ary k = 2 tree data structure in which each node has at most two children, which are referred to as the ' and the '. A recursive definition using just set theory notions is that a (non-empty) binary t ...
s states that it is to be an instance of the classes Eq
and Show
:
data BinTree a = Leaf a , Node (BinTree a) a (BinTree a)
deriving (Eq, Show)
This results in an equality function (
) and a string representation function (show
) being automatically defined for any type of the form BinTree T
provided that T
itself supports those operations.
The support for derived instances of Eq
and Show
makes their methods
and show
generic in a qualitatively different way from parametrically polymorphic functions: these "functions" (more accurately, type-indexed families of functions) can be applied to values of various types, and although they behave differently for every argument type, little work is needed to add support for a new type. Ralf Hinze (2004) has shown that a similar effect can be achieved for user-defined type classes by certain programming techniques. Other researchers have proposed approaches to this and other kinds of genericity in the context of Haskell and extensions to Haskell (discussed below).
= PolyP
=
PolyP was the first generic programming language extension to Haskell. In PolyP, generic functions are called ''polytypic''. The language introduces a special construct in which such polytypic functions can be defined via structural induction over the structure of the pattern functor of a regular datatype. Regular datatypes in PolyP are a subset of Haskell datatypes. A regular datatype t must be of kind ''* → *'', and if ''a'' is the formal type argument in the definition, then all recursive calls to ''t'' must have the form ''t a''. These restrictions rule out higher-kinded datatypes as well as nested datatypes, where the recursive calls are of a different form.
The flatten function in PolyP is here provided as an example:
flatten :: Regular d => d a -> flatten = cata fl
polytypic fl :: f a -> case f of
g+h -> either fl fl
g*h -> \(x,y) -> fl x ++ fl y
() -> \x -> []
Par -> \x -> [x]
Rec -> \x -> x
d@g -> concat . flatten . pmap fl
Con t -> \x -> []
cata :: Regular d => (FunctorOf d a b -> b) -> d a -> b
=Generic Haskell
=
Generic Haskell is another extension to Haskell, developed at Utrecht University
Utrecht University (UU; nl, Universiteit Utrecht, formerly ''Rijksuniversiteit Utrecht'') is a public research university in Utrecht, Netherlands. Established , it is one of the oldest universities in the Netherlands. In 2018, it had an enrollme ...
in the Netherlands
)
, anthem = ( en, "William of Nassau")
, image_map =
, map_caption =
, subdivision_type = Sovereign state
, subdivision_name = Kingdom of the Netherlands
, established_title = Before independence
, established_date = Spanish Netherl ...
. The extensions it provides are:
*''Type-indexed values'' are defined as a value indexed over the various Haskell type constructors (unit, primitive types, sums, products, and user-defined type constructors). In addition, we can also specify the behaviour of a type-indexed values for a specific constructor using ''constructor cases'', and reuse one generic definition in another using ''default cases''.
The resulting type-indexed value can be specialized to any type.
*''Kind-indexed types'' are types indexed over kinds, defined by giving a case for both ''*'' and ''k → k. Instances are obtained by applying the kind-indexed type to a kind.
*Generic definitions can be used by applying them to a type or kind. This is called ''generic application''. The result is a type or value, depending on which sort of generic definition is applied.
*''Generic abstraction'' enables generic definitions be defined by abstracting a type parameter (of a given kind).
*''Type-indexed types'' are types that are indexed over the type constructors. These can be used to give types to more involved generic values. The resulting type-indexed types can be specialized to any type.
As an example, the equality function in Generic Haskell:
type Eq t1 t2 = t1 -> t2 -> Bool
type Eq t1 t2 = forall u1 u2. Eq u1 u2 -> Eq (t1 u1) (t2 u2)
eq :: Eq t t
eq _ _ = True
eq eqA eqB (Inl a1) (Inl a2) = eqA a1 a2
eq eqA eqB (Inr b1) (Inr b2) = eqB b1 b2
eq eqA eqB _ _ = False
eq eqA eqB (a1 :*: b1) (a2 :*: b2) = eqA a1 a2 && eqB b1 b2
eq = ()
eq = ()
eq = ()
Clean
Clean offers generic programming based and the as supported by the GHC ≥ 6.0. It parametrizes by kind as those but offers overloading.
Other languages
Languages in the ML family support generic programming through parametric polymorphism
In programming languages and type theory, parametric polymorphism allows a single piece of code to be given a "generic" type, using variables in place of actual types, and then instantiated with particular types as needed. Parametrically polymorph ...
and generic modules
Broadly speaking, modularity is the degree to which a system's components may be separated and recombined, often with the benefit of flexibility and variety in use. The concept of modularity is used primarily to reduce complexity by breaking a sy ...
called ''functors.'' Both Standard ML
Standard ML (SML) is a general-purpose, modular, functional programming language with compile-time type checking and type inference. It is popular among compiler writers and programming language researchers, as well as in the development of the ...
and OCaml
OCaml ( , formerly Objective Caml) is a general-purpose programming language, general-purpose, multi-paradigm programming language which extends the Caml dialect of ML (programming language), ML with object-oriented programming, object-oriented ...
provide functors, which are similar to class templates and to Ada's generic packages. Scheme A scheme is a systematic plan for the implementation of a certain idea.
Scheme or schemer may refer to:
Arts and entertainment
* ''The Scheme'' (TV series), a BBC Scotland documentary series
* The Scheme (band), an English pop band
* ''The Schem ...
syntactic abstractions also have a connection to genericity – these are in fact a superset of C++ templates.
A Verilog
Verilog, standardized as IEEE 1364, is a hardware description language (HDL) used to model electronic systems. It is most commonly used in the design and verification of digital circuits at the register-transfer level of abstraction. It is als ...
module may take one or more parameters, to which their actual values are assigned upon the instantiation of the module. One example is a generic register
Register or registration may refer to:
Arts entertainment, and media Music
* Register (music), the relative "height" or range of a note, melody, part, instrument, etc.
* ''Register'', a 2017 album by Travis Miller
* Registration (organ), th ...
array where the array width is given via a parameter. Such an array, combined with a generic wire vector, can make a generic buffer or memory module with an arbitrary bit width out of a single module implementation.
VHDL
The VHSIC Hardware Description Language (VHDL) is a hardware description language (HDL) that can model the behavior and structure of digital systems at multiple levels of abstraction, ranging from the system level down to that of logic gates ...
, being derived from Ada, also has generic capabilities. https://www.ics.uci.edu/~jmoorkan/vhdlref/generics.html VHDL Reference
C supports "type-generic expressions" using the keyword:WG14 N1516 Committee Draft — October 4, 2010
/ref>
#define cbrt(x) _Generic((x), long double: cbrtl, \
default: cbrt, \
float: cbrtf)(x)
See also
* Concept (generic programming) In generic programming, a concept is a description of supported operations on a type, including syntax and semantics. In this way, concepts are related to abstract types but concepts do not require a subtype relationship.
Language use
The term wa ...
* Partial evaluation
In computing, partial evaluation is a technique for several different types of program optimization by specialization. The most straightforward application is to produce new programs that run faster than the originals while being guaranteed to ...
* Template metaprogramming
Template metaprogramming (TMP) is a metaprogramming technique in which templates are used by a compiler to generate temporary source code, which is merged by the compiler with the rest of the source code and then compiled. The output of these te ...
* Type polymorphism
In programming language theory and type theory, polymorphism is the provision of a single interface to entities of different types or the use of a single symbol to represent multiple different types.: "Polymorphic types are types whose operatio ...
References
Sources
*
*
*
Further reading
* Gabriel Dos Reis and Jaakko Järvi,
What is Generic Programming?
'
LCSD 2005
.
*
*
External links
generic-programming.org
* Alexander A. Stepanov
Collected Papers of Alexander A. Stepanov
(creator of the STL)
;C++/D
* Walter Bright,
Templates Revisited
''
* David Vandevoorde, Nicolai M Josuttis, ''C++ Templates: The Complete Guide'', 2003 Addison-Wesley.
;C#/.NET
* Jason Clark,
Introducing Generics in the Microsoft CLR
" September 2003, ''MSDN Magazine'', Microsoft.
* Jason Clark,
More on Generics in the Microsoft CLR
" October 2003, ''MSDN Magazine'', Microsoft.
* M. Aamir Maniar
Generics.Net
An open source generics library for C#.
;Delphi/Object Pascal
* Nick Hodges,
Delphi 2009 Reviewers Guide
" October 2008, ''Embarcadero Developer Network'', Embarcadero.
* Craig Stuntz,
Delphi 2009 Generics and Type Constraints
" October 2008
* Dr. Bob,
* Free Pascal
Free Pascal Compiler (FPC) is a compiler for the closely related programming-language dialects Pascal and Object Pascal. It is free software released under the GNU General Public License, witexception clausesthat allow static linking against it ...
Free Pascal Reference guide Chapter 8: Generics
Michaël Van Canneyt, 2007
* Delphi for Win32
Generics with Delphi 2009 Win32
Sébastien DOERAENE, 2008
* Delphi for .NET
Felix COLIBRI, 2008
;Eiffel
;Haskell
* Johan Jeuring, Sean Leather, José Pedro Magalhães, and Alexey Rodriguez Yakushev
''Libraries for Generic Programming in Haskell''
Utrecht University.
* Dæv Clarke, Johan Jeuring and Andres Löh
The Generic Haskell user's guide
* Ralf Hinze,
Generics for the Masses
" In ''Proceedings of the ACM SIGPLAN
SIGPLAN is the Association for Computing Machinery's Special Interest Group on programming languages.
Conferences
* Principles of Programming Languages (POPL)
* Programming Language Design and Implementation (PLDI)
* International Symposium on M ...
International Conference on Functional Programming The ACM SIGPLAN International Conference on Functional Programming (ICFP) is an annual academic conference in the field of computer science sponsored by the ACM SIGPLAN, in association with IFIP Working Group 2.8 (Functional Programming). The con ...
(ICFP),'' 2004.
* Simon Peyton Jones
Simon Peyton Jones (born 18 January 1958) is a British computer scientist who researches the implementation and applications of functional programming languages, particularly lazy functional programming.
Education
Peyton Jones graduated fr ...
, editor,
The Haskell 98 Language Report
'' Revised 2002.
* Ralf Lämmel
Ralph (pronounced ; or ,) is a male given name of English, Scottish and Irish origin, derived from the Old English ''Rædwulf'' and Radulf, cognate with the Old Norse ''Raðulfr'' (''rað'' "counsel" and ''ulfr'' "wolf").
The most common forms ...
and Simon Peyton Jones
Simon Peyton Jones (born 18 January 1958) is a British computer scientist who researches the implementation and applications of functional programming languages, particularly lazy functional programming.
Education
Peyton Jones graduated fr ...
, "Scrap Your Boilerplate: A Practical Design Pattern for Generic Programming," In ''Proceedings of the ACM SIGPLAN
SIGPLAN is the Association for Computing Machinery's Special Interest Group on programming languages.
Conferences
* Principles of Programming Languages (POPL)
* Programming Language Design and Implementation (PLDI)
* International Symposium on M ...
International Workshop on Types in Language Design and Implementation (TLDI'03),'' 2003. (Also see the websit
devoted to this research
* Andres Löh,
Exploring Generic Haskell
'' PhD thesis, 2004 Utrecht University
Utrecht University (UU; nl, Universiteit Utrecht, formerly ''Rijksuniversiteit Utrecht'') is a public research university in Utrecht, Netherlands. Established , it is one of the oldest universities in the Netherlands. In 2018, it had an enrollme ...
.
Generic Haskell: a language for generic programming
;Java
* Gilad Bracha,
Generics in the Java Programming Language
'' 2004.
* Maurice Naftalin and Philip Wadler, ''Java Generics and Collections,'' 2006, O'Reilly Media, Inc.
* Peter Sestoft, ''Java Precisely, Second Edition,'' 2005 MIT Press.
* , 2004 Sun Microsystems, Inc.
* Angelika Langer
{{Authority control
Articles with example C Sharp code