Skip to content

Parametric polymorphism

"Parametric polymorphism"即“参数多态性”,在 generic programming 中,能够实现parametric polymorphism。

wikipedia Parametric polymorphism

In programming languages and type theory, parametric polymorphism is a way to make a language more expressive, while still maintaining full static type-safety. Using parametric polymorphism, a function or a data type can be written generically so that it can handle values identically without depending on their type.[1] Such functions and data types are called generic functions and generic datatypes respectively and form the basis of generic programming.

NOTE: 在wikipedia Polymorphism (computer science) 中总结的非常好:

"when one or more types are not specified by name but by abstract symbols that can represent any type."