Parametric polymorphism: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added labels to each of the node's output, added/changed comments and whitespace.) |
m (added more whitespace to the task's preamble, added a ;Task section header.) |
||
Line 1: | Line 1: | ||
{{task|Basic language learning}} |
{{task|Basic language learning}} |
||
[[Category:Type System]] |
[[Category:Type System]] |
||
[[wp:Parametric Polymorphism|Parametric Polymorphism]] is a way to define types or functions that are generic over other types. The genericity can be expressed by using ''type variables'' for the parameter type, and by a mechanism to explicitly or implicitly replace the type variables with concrete types when necessary. |
[[wp:Parametric Polymorphism|Parametric Polymorphism]] is a way to define types or functions that are generic over other types. The genericity can be expressed by using ''type variables'' for the parameter type, and by a mechanism to explicitly or implicitly replace the type variables with concrete types when necessary. |
||
⚫ | |||
;Task: |
|||
Write a small example for a type declaration that is parametric over another type, together with a short bit of code (and its type signature) that uses it. |
|||
⚫ | |||
This language feature only applies to statically-typed languages. |
This language feature only applies to statically-typed languages. |
||
<br><br> |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |