Check out my first novel, midnight's simulacra!

Programming Language Theory: Difference between revisions

From dankwiki
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. The benefits of static typing include:
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). 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.
* Improved performance, reduced resource requirements
* Improved performance, reduced resource requirements
* Secure data abstractions can be built atop the safety of strong typing systems
* Secure data abstractions can be built atop the safety of strong typing systems
Properties of a typing system include:
* 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)


==Objects==
==Objects==