Check out my first novel, midnight's simulacra!
Programming Language Theory: Difference between revisions
From dankwiki
No edit summary |
(→Typing) |
||
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. 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: | Weak- vs strong-typing refers to the degree to which the language's typing system can be subverted, and whether this is regularly necessary. Typing insecurities include: | ||
* Untyped pointers | |||
* Subrange narrowing / downcasting | |||
* Untagged variant records ("type punning") | |||
* Procedure parameters | |||
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. |