Our website is made possible by displaying online advertisements to our visitors.
Please consider supporting us by disabling your ad blocker.

Responsive image


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.[1]: 340  Parametrically polymorphic functions and data types are sometimes called generic functions and generic datatypes, respectively, and they form the basis of generic programming.

Parametric polymorphism may be contrasted with ad hoc polymorphism. Parametrically polymorphic definitions are uniform: they behave identically regardless of the type they are instantiated at.[1]: 340 [2]: 37  In contrast, ad hoc polymorphic definitions are given a distinct definition for each type. Thus, ad hoc polymorphism can generally only support a limited number of such distinct types, since a separate implementation has to be provided for each type.

  1. ^ a b Cite error: The named reference TAPL was invoked but never defined (see the help page).
  2. ^ Cite error: The named reference Strachey 1967 was invoked but never defined (see the help page).

Previous Page Next Page






Παραμετρικός πολυμορφισμός Greek چندریختی پارامتری FA Polimorfismo paramétrico Portuguese Параметрический полиморфизм Russian 参数多态 Chinese

Responsive image

Responsive image