Generic programming: Difference between revisions

Content deleted Content added
improve some grammar, orthography, and formatting in intro
Tags: Mobile edit Mobile app edit iOS app edit
Line 14:
| pages=9–10}}</ref><ref>{{cite conference |last1=Milner |first1=R. |last2=Morris |first2=L. |last3=Newey |first3=M. |year=1975 |title=A Logic for Computable Functions with Reflexive and Polymorphic Types |book-title=Proceedings of the Conference on Proving and Improving Programs}}</ref> permits writing common [[function (computer science)|functions]] or [[type (computer science)|type]]s that differ only in the set of types on which they operate when used, thus reducing [[duplicate code]].
 
GenericsGeneric programming was introduced to the main-stream programmingmainstream with [[Ada (programming language)|Ada]] in 1977. andWith then with ''[[Template (C++)|templates]]'' in [[C++]], itgeneric programming became part of the repertoire of professional library design. The techniques were further improved and ''parameterized types'' were introduced in the influential 1994 book ''[[Design Patterns (book)|Design Patterns]]''.<ref name="GoF">
{{cite book |last1=Gamma
|first1=Erich
Line 31:
}}</ref>
 
New techniques were introduced by [[Andrei Alexandrescu]] in his 2001 book, ''[[Modern C++ Design]]|Modern C++ Design: Generic Programming and Design Patterns Applied]]''. Subsequently, [[D (programming language)|D]] implemented the same ideas.
 
Such software entities are known as ''generics'' in [[Ada (programming language)|Ada]], [[C Sharp (programming language)|C#]], [[Delphi (software)|Delphi]], [[Eiffel (programming language)|Eiffel]], [[F Sharp (programming language)|F#]], [[Java (programming language)|Java]], [[Nim (programming language)|Nim]], [[Python (programming language)|Python]], [[Go (programming language)|Go]], [[Rust (programming language)|Rust]], [[Swift (programming language)|Swift]], [[TypeScript]], and [[Visual Basic .NET]]. They are known as ''[[parametric polymorphism]]'' in [[ML (programming language)|ML]], [[Scala (programming language)|Scala]], [[Julia (programming language)|Julia]], and [[Haskell]]. (Haskell terminology also uses the term "generic" for a related but somewhat different concept).)
 
The term "''generic programming"'' was originally coined by [[David Musser]] and [[Alexander Stepanov]]{{sfn|Musser|Stepanov|1989}} in a more specific sense than the above, to describe a programming paradigm wherebyin which fundamental requirements on data types are abstracted from across concrete examples of algorithms and [[data structure]]s and formalized as [[Concept (generic programming)|concepts]], with [[generic function]]s implemented in terms of these concepts, typically using language genericity mechanisms as described above.
 
== Stepanov–Musser and other generic programming paradigms ==