Abstract

Introduction Polymorphic means to have many forms. As related to programming languages, it refers to data or programs which have many types, or which operate on many types. There are several arbitrary ways in which programs can have many types; we are mostly interested in a particularly orderly form of polymorphism called parametric polymorphism. This is a property of programs which are parametric with respect to the type of some of their identifiers. There are two major ways of achieving parametric polymorphism which are conceptually related but pragmatically very different: explicit and implicit polymorphism. Parametric polymorphism is called explicit when parametrization is obtained by explicit type parameters in procedure headings, and corresponding explicit applications of type arguments when procedures are called. In this case, parametric polymorphism reduces to the notion of having parameters of type type (without necessarily adopting the notion that type has itself type type). Here is a definition of the polymorphic identity with explicit type parameters (where fun stands for λ-abstraction) and its application to an integer and a boolean:

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call