Parametric Polymorphism
What is parametric polymorphism? It sounds like such a cool phrase. Parametric polymorphism is a function or datatype that can be written generically so that it can deal equally well with any objects without depending on their type. .NET Generics are derived from the principles of parametric polymorphism.
There is even a formula for parametric polymorphism.
"Any dynamically typed function
f
that takes
n
arguments can be given a static type using parametric polymorphism:
f
:
p
1
× ... ×
p
n
→
r
, where
p
1
, ...,
p
n
and
r
are type parameters."
What practical bearing does this formula have on .NET Generics? Nothing, but I'm a math person and I think formulas are cool.
R