Programming Language Theory: Difference between revisions
| Line 125: | Line 125: | ||
==Typing== | ==Typing== | ||
Weak- vs strong-typing refers to the degree to which the language's typing system can be subverted, and whether this is regularly necessary. Static- vs dynamic-typing refers to (among other possible definitions) whether type is determined at compile-time or run-time | Weak- vs strong-typing refers to the degree to which the language's typing system can be subverted, and whether this is regularly necessary. Static- vs dynamic-typing refers to (among other possible definitions) whether type is determined at compile-time or run-time. Among dynamic typing, ''duck typing'' types based on (dynamically-bound) method availability; variants of static typing include ''structural typing'' (relations based on form) and ''nominative typing'' (relations based on names). The benefits of static typing include: | ||
* Detection of many types of errors at compile-time | * Detection of many types of errors at compile-time | ||
** "Safety = Progress + Preservation" (Harper 1994) suggests well-typed expressions ought not get [[Programming_Language_Theory#Divergent_Combinators|stuck]], and that reductions of well-typed expressions are themselves well-typed. | ** "Safety = Progress + Preservation" (Harper 1994) suggests well-typed expressions ought not get [[Programming_Language_Theory#Divergent_Combinators|stuck]], and that reductions of well-typed expressions are themselves well-typed. | ||
| Line 133: | Line 133: | ||
* Support for ''polymorphism'' (dispatch based on types of actual arguments) | * Support for ''polymorphism'' (dispatch based on types of actual arguments) | ||
** Parametric polymorphism: Generation of a version for necessary types (Ada generics, C++ templates, SML type parameters) | ** Parametric polymorphism: Generation of a version for necessary types (Ada generics, C++ templates, SML type parameters) | ||
* Support for ''subtyping'' | |||
* Support for ''minimal'' and ''maximal'' types (also known as Bottom and Top) | |||
==Objects== | ==Objects== | ||