Comparison of programming languages by type system
This comparison of programming languages (type system) compares the features of type systems or their type checking for multiple programming languages.
Brief definitions
- A nominal type system means that the language decides whether types are compatible and/or equivalent based on explicit declarations and names.
- A structural type system means that the language decides whether types are compatible and/or equivalent based on the definition and characteristics of the types.
- Type checking determines whether and when types are verified. Static checking means that type errors are reported based on a program's text (source code). Dynamic checking means that type errors are reported based on a program's dynamic (run-time) behavior.
Language | Type safety | Type expression | Type compatibility and equivalence | Type checking |
---|---|---|---|---|
ActionScript 3.0 | safe | implicit with optional explicit typing | static | |
Ada | safe[TS 1] | explicit | nominal | static |
Aldor | unsafe | implicit | static | |
ALGOL 58 | safe | explicit | static | |
ALGOL 60 | safe | explicit | static | |
ALGOL 68 | safe | explicit | structural | static & tagged unions |
APL | safe | dynamic | ||
AutoHotkey | typeless | n/a | n/a | n/a |
Ateji PX | safe | explicit | nominal | static |
Bash | ? | ? | ? | ? |
BASIC | safe | explicit | nominal | static |
BLISS | typeless | n/a | n/a | n/a |
BeanShell | safe | nominal | dynamic | |
Boo | safe | implicit with optional explicit typing | static with optional dynamic typing | |
Bro | safe | implicit with optional explicit typing | nominal | static |
C | unsafe | explicit | nominal | static |
C++ (ISO/IEC 14882) | unsafe | explicit | nominal | static[TS 2] |
C# | unsafe[TS 3] | implicit with optional explicit typing | nominal | static[TS 4] |
Clean | safe | implicit | static | |
Clojure | safe | implicit with optional explicit typing | dynamic | |
COBOL | safe | explicit | nominal | static |
ColdFusion (CFML) | safe | implicit | dynamic | |
Common Lisp | safe | implicit with optional explicit typing | dynamic | |
Curl | safe | nominal | ||
Cython | safe | implicit with optional explicit typing | nominal (extension types) and structural (Python) | dynamic with optional static typing |
D | unsafe[TS 3] | explicit | nominal | static |
Dylan | safe | dynamic | ||
Eiffel | safe | nominal | static | |
Erlang | safe | implicit | dynamic | |
Euphoria | safe | explicit, implicit with objects | nominal | static, dynamic with objects |
F# | safe | implicit | nominal | static |
Falcon | safe | implicit | structural | dynamic |
Forth | typeless | n/a | n/a | n/a |
Fortran | safe | explicit[TS 5] | nominal | static |
Gambas | safe | explicit | nominal | |
GLBasic | safe | explicit. Non-explicit declarations available through project options | nominal | static |
Go[1] | safe | implicit with optional explicit typing | structural | static |
Gosu | safe | partially implicit (local type inference) | nominal (subclassing) and structural (structural) | static |
Groovy | safe | implicit with optional explicit typing | dynamic with optional static typing | |
Harbour | safe | implicit with optional explicit typing | dynamic | |
Haskell | safe | implicit with optional explicit typing | structural | static |
Haxe | safe | implicit with optional explicit typing | nominal (subclassing) and structural (structural) | static with optional dynamic typing |
Io | safe | implicit | dynamic | |
ISLISP | safe | dynamic | ||
J | safe | dynamic | ||
Java | safe[2] | explicit | nominal | static |
JavaScript | safe | implicit | structural | dynamic |
Julia | safe | implicit with optional explicit typing[3] | structural for implicit typing, nominal for explicit typing | dynamic |
Joy | safe | dynamic | ||
Kotlin | safe | partially implicit (local type inference) | nominal | static |
LabVIEW | safe | |||
Lua | safe | implicit | dynamic | |
Maple | safe | dynamic | ||
Mathematica | safe | dynamic | ||
MATLAB M-code | safe | dynamic | ||
Modula-2 | unsafe[TS 3] | explicit | nominal | static |
Modula-3 | unsafe[TS 3] | explicit | structural | static |
MUMPS (M) | typeless | n/a | n/a | n/a |
Oberon | safe | explicit | nominal | static and partially dynamic[TS 6] |
Objective-C | safe | explicit | nominal | dynamic with optional static typing[4] |
OCaml | safe | implicit with optional explicit typing | structural (records are nominal) | static |
Object Pascal | safe | explicit | nominal | static |
Opa | safe | implicit with optional explicit typing | structural | static |
Oxygene | unsafe | implicit | static | |
Oz-Mozart | safe | implicit | structural | dynamic |
Pascal | unsafe[TS 3] | explicit | nominal | static |
Perl 5 | implicit | dynamic | ||
Perl 6 | partially implicit[TS 7] | dynamic with optional static typing | ||
PHP | implicit with optional explicit typing | dynamic | ||
Plus | safe | explicit | structural | static, dynamic (optional) |
Prolog | dynamic | |||
Pure | dynamic | |||
Python | safe | implicit | structural | dynamic |
REBOL | safe | implicit | dynamic | |
Rexx | typeless | n/a, implicit wrt numbers | n/a | static+dynamic wrt numbers |
RPG | unsafe | static | ||
Ruby | safe | implicit | structural | dynamic |
Rust | safe | implicit with optional explicit typing | static | |
S | dynamic | |||
S-Lang | safe | implicit | dynamic | |
Scala | safe | partially implicit (local type inference) | nominal (subclassing) and structural (structural) | static |
Scheme | safe | implicit | dynamic (latent) | |
Seed7 | safe | explicit | nominal | static |
Simula | safe | static[TS 8] | ||
Smalltalk | safe | implicit | dynamic | |
Swift | safe | partially implicit (local type inference) | nominal (subclassing) and structural (structural) | static |
Standard ML | safe | implicit with optional explicit typing | structural | static |
Tcl | dynamic | |||
Visual Basic | safe | implicit with optional explicit typing | nominal | static |
Visual Basic .NET | unsafe[TS 3] | explicit | static | |
Visual Prolog | safe | partially implicit | nominal | static |
Wolfram Language | safe | dynamic | ||
Windows PowerShell | safe | implicit | dynamic | |
XL | safe | nominal | static | |
Xojo | safe | explicit | nominal | static |
XPath/XQuery | safe | partially implicit | nominal | dynamic with optional static typing |
Language | Type safety | Type expression | Type compatibility among composites | Type checking |
- ↑ Unsafe operations are well isolated by a "Unchecked_" prefix.
- ↑ with optional dynamic type casting (see dynamic cast)
- 1 2 3 4 5 6 It is almost safe, unsafe features are not commonly used.
- ↑ with optional dynamic type (see dynamic member lookup)
- ↑ Optionally, typing can be explicitly implied by the first letter of the identifier (known as implicit typing within the Fortran community).
- ↑ dynamic checking of type extensions i.e. inherited types
- ↑ explicit for static types
- ↑ optional for formal and virtual procedures
- ↑ The Go Programming Language Specification
- ↑ Sheng Liang, Gilad Bracha. Dynamic class loading in the Java virtual machine. Volume 33, Issue 10 of ACM SIGPLAN Notices, October 1998.
- ↑ http://julia.readthedocs.org/en/latest/manual/types/
- ↑ Developer.apple.com Archived June 10, 2009, at the Wayback Machine.
This article is issued from Wikipedia - version of the 11/29/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.