Comparison of type systems
Programming language | static / dynamic | strong / weak | safety | nominative / structural |
---|---|---|---|---|
Ada | static | strong | safe | nominative |
Assembly language | none | strong | unsafe | structural |
APL | dynamic | weak | safe | nominative |
BASIC | static | weak | safe | nominative |
C | static | weak | unsafe | nominative |
C++ | static | strong | unsafe | nominative |
C#[1] | static | strong | both | nominative |
Cayenne | dependent | strong | safe | structural |
Clipper | dynamic | weak | safe | duck |
D | static | strong | both[2] | nominative |
Delphi | static | strong | safe | nominative |
E | dynamic | strong | safe | nominative + duck |
Eiffel | static | strong | safe | nominative |
Erlang | dynamic | strong | safe | nominative |
F# | static | strong | safe | nominative |
Fortran | static | strong | safe | nominative |
Go | static | strong | safe | structural |
Groovy | dynamic | strong | safe | duck |
Haskell | static | strong | safe | nominative + structural |
Io | dynamic | strong | safe | duck |
Java | static | strong | safe | nominative |
JavaScript | dynamic | weak | safe | duck |
Julia | dynamic + static | strong | both? A usable subset is safe.[3] | See manual[4] |
Lisp | dynamic | strong | safe | structural |
Lua[5] | dynamic | weak | safe | structural |
ML | static | strong | safe | structural |
Objective-C[6] | static+dynamic | strong | unsafe | nominative |
Pascal | static | strong | safe | nominative |
Perl 1–5 | dynamic | weak | safe | nominative |
Perl 6[7] | hybrid | hybrid | safe | duck |
PHP | dynamic | weak | safe | ? |
Pike | static+dynamic | strong | safe | structural |
Python | dynamic | strong | safe | duck |
Ruby | dynamic | strong | safe | duck |
Scala[8] | static | strong | safe | nominative + structural |
Scheme | dynamic | strong | safe | nominative |
Smalltalk | dynamic | strong | safe | duck |
Swift | static | strong | safe | nominative |
Visual Basic | hybrid | hybrid | safe | nominative |
Windows PowerShell | hybrid | hybrid | safe | duck |
xHarbour | dynamic | weak | safe | duck |
References
- ↑ The C basis is unchanged. 3.0 has hybrid typing with Anonymous Types. Can be both unsafe and safe with use of 'unsafe' functions and code blocks.
- ↑ D's philosophy is: safe by default with unsafe "backdoors". D also supports @safe functions that provably can't corrupt memory at the cost of disabling some of the unsafe language constructs.
- ↑ "RFC / Discussion: Security and Julia".
Julia code can do anything C code can (e.g. you can work with raw unchecked pointers if you want to), so it is equivalent to C code in terms of security. i.e. you should not run untrusted Julia code, unless you use OS-level sandboxing.
- ↑ docs.julialang.org/en/release-0.5/manual/conversion-and-promotion/
- ↑ Variables can change type with the use of metatables.
- ↑ Applies to the Objective-C extension only.
- ↑ Not yet released.
- ↑ Scala supports structural types through runtime reflection on the JVM
This article is issued from Wikipedia - version of the 11/9/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.