This is a comparison of the features of the type systems and type checking of multiple programming languages.
Brief definitions
Language | Type safety | Type expression | Type compatibility and equivalence | Type checking |
---|---|---|---|---|
A+ | strong | dynamic | ||
ActionScript 3.0 | strong | implicit with optional explicit typing | static | |
ABC | strong | |||
ABAP | strong | nominal | static | |
Ada | strong [TS 1] | explicit | nominal | static |
Agda | strong | nominal | static | |
Aldor | weak | partially implicit [1] | static | |
Alef | strong | static | ||
ALGOL 58 | strong | explicit | static | |
ALGOL 60 | strong | explicit | static | |
ALGOL 68 | strong | explicit | structural | static & tagged unions |
ALGOL W | strong | static | ||
Alice | strong | implicit with optional explicit | static | |
Alma-0 | static | |||
AmbientTalk | strong | dynamic | ||
AMOS BASIC | static | |||
AngelScript | strong | static | ||
APL | strong | dynamic | ||
AppleScript | weak | dynamic | ||
Arc | dynamic | |||
Assembly | ? | ? | ? | ? |
AutoHotkey | typeless | — | — | — |
AutoLISP | dynamic | |||
Ateji PX | strong | explicit | nominal | static |
AWK | weak | implicit | dynamic | |
B | typeless | |||
Ballerina | strong | structural | static | |
Bash | ? | ? | ? | ? |
BASIC | strong | explicit | nominal | static |
BCPL | typeless | |||
BeanShell | strong | nominal | dynamic | |
BLISS | typeless | — | — | — |
Boo | strong | implicit with optional explicit typing | static with optional dynamic typing | |
Bro | strong | implicit with optional explicit typing | nominal | static |
C | weak | explicit | nominal | static |
C-- | weak | static | ||
C++ (ISO/IEC 14882) | weak | explicit with optional implicit typing (by using auto in C++11) | nominal | static [TS 2] |
C* | weak | explicit | static | |
C# | weak [TS 3] | implicit with optional explicit typing | nominal | static [TS 4] |
C shell | ? | ? | ? | ? |
Caml | strong | implicit with optional explicit typing | static | |
Cecil | dynamic with optional static typing | |||
Clean | strong | implicit | static | |
Ceylon | strong | static | ||
Chapel | implicit with optional explicit typing | static | ||
CHILL | strong | static | ||
ChucK | strong | |||
Cilk | weak | explicit | static | |
Claire | strong | implicit with optional explicit typing | dynamic with optional static typing | |
Clean | strong | ? | ||
Clojure | strong | implicit with optional explicit typing | dynamic | |
CLU | strong | |||
COBOL | strong | explicit | nominal | static |
Cobra | strong | explicit with optional implicit typing | static with optional dynamic typing | |
CoffeeScript | implicit | dynamic | ||
ColdFusion (CFML) | strong | implicit | dynamic | |
COMAL | strong | |||
Common Lisp | strong | implicit with optional explicit typing | structural for implicit typing, nominal for explicit typing | dynamic, some static checking(depending on implementation) |
Component Pascal | strong | static | ||
Cool | strong | explicit | static | |
CORAL | strong | static | ||
Crystal | implicit with optional explicit typing [2] | structural | static | |
Cuneiform | explicit | static | ||
Curl | strong | nominal | ||
Curry | strong | implicit with optional explicit typing | static | |
Cython | strong | implicit with optional explicit typing | nominal (extension types) and structural (Python) | dynamic with optional static typing |
D | weak [TS 3] | explicit | nominal | static |
Dart | strong [3] | gradual typing | nominal | static with optional dynamic typing |
Dylan | strong | dynamic | ||
Eiffel | strong | nominal | static | |
Elixir | strong | implicit | dynamic | |
Erlang | strong | implicit | dynamic | |
Euphoria | strong | explicit, implicit with objects | nominal | static, dynamic with objects |
F# | strong | implicit | nominal | static |
Forth | typeless | — | — | — |
Fortran | strong | explicit [TS 5] | nominal | static |
Gambas | strong | explicit | nominal | |
GLBasic | strong | explicit. Non-explicit declarations available through project options | nominal | static |
Gleam | strong | implicit with optional explicit | nominal | static |
Go [4] | strong | partially implicit (local type inference) | structural | static |
Gosu | strong | partially implicit (local type inference) | nominal (subclassing) and structural | static |
Groovy | strong | implicit with optional explicit typing | dynamic with optional static typing | |
Harbour | strong | implicit with optional explicit typing | dynamic | |
Haskell | strong | implicit with optional explicit typing | nominal [5] [6] | static |
Haxe | strong | implicit with optional explicit typing | nominal (subclassing) and structural | static with optional dynamic typing |
Io | strong | implicit | dynamic | |
icon | strong | implicit | dynamic | |
ISLISP | strong | dynamic | ||
J | strong | dynamic | ||
Java | strong [7] | explicit | nominal | static |
JavaScript | weak | implicit | — | dynamic |
Julia | strong | implicit with optional explicit typing [8] | structural for implicit typing, nominal for explicit typing | dynamic |
Joy | strong | dynamic | ||
Kotlin | strong | partially implicit (local type inference) | nominal | static |
LabVIEW | strong | |||
Lua | strong | implicit | dynamic | |
Maple | strong | dynamic | ||
Mercury | strong | static | ||
Mathematica | strong | dynamic | ||
MATLAB M-code | strong | dynamic | ||
Modula-2 | weak [TS 3] | explicit | nominal | static |
Modula-3 | weak [TS 3] | explicit | structural | static |
MUMPS (M) | typeless | — | — | — |
Neko | dynamic | |||
Nemerle | strong | implicit | nominal | static |
NetLogo | strong | implicit | dynamic | |
NetRexx | strong | implicit with optional explicit | dynamic with optional static typing | |
newLisp | implicit | dynamic | ||
NEWP | strong | static | ||
Newspeak | dynamic | |||
NewtonScript | dynamic | |||
Nial | dynamic | |||
Nim | strong | partially implicit (type inference) | static | |
Nickle | strong | |||
Nu | dynamic | |||
Oberon | strong | explicit | nominal | static and partially dynamic [TS 6] |
Objective-C | strong | explicit | nominal | dynamic with optional static typing [9] |
OCaml | strong | implicit with optional explicit typing | nominal for records, [10] structural for objects [6] [11] | static |
Object Pascal | strong | explicit | nominal | static |
Opa | strong | implicit with optional explicit typing | structural | static |
Oxygene | weak | implicit | static | |
Oz-Mozart | strong | implicit | structural | dynamic |
Pascal | weak [TS 3] | explicit | nominal | static |
Perl 5 | implicit | dynamic | ||
PHP | weak | implicit with optional explicit typing | nominal | dynamic |
Plus | strong | explicit | structural | static, dynamic (optional) |
Prolog | dynamic | |||
Pure | dynamic | |||
PureScript | strong | implicit with optional explicit typing | nominal | static |
Python | strong | implicit (with optional explicit typing as of 3.5) | nominal | dynamic |
R | implicit | dynamic | ||
Raku | partially implicit [TS 7] | dynamic with optional static typing | ||
REBOL | strong | implicit | dynamic | |
Rexx | typeless | —, implicit wrt numbers | — | static+dynamic wrt numbers |
RPG | weak | static | ||
Ruby | strong | implicit | — | dynamic |
Rust | strong | explicit with optional implicit typing [12] | mostly nominal | static |
S | dynamic | |||
S-Lang | strong | implicit | dynamic | |
Scala | strong | partially implicit (local type inference) | nominal (subclassing) and structural | static |
Scheme | strong | implicit | dynamic (latent) | |
Seed7 | strong | explicit | nominal | static |
Simula | strong | static [TS 8] | ||
Smalltalk | strong | implicit | dynamic | |
Swift | strong | partially implicit (local type inference) | nominal (subclassing) and structural | static |
Standard ML | strong | implicit with optional explicit typing | structural | static |
Tcl | dynamic | |||
TypeScript | ? | optional | structural | static |
Unicon | strong | implicit | dynamic | |
Visual Basic | strong | implicit with optional explicit typing | nominal | static |
Visual Basic (.NET) | weak [TS 3] | explicit | static | |
Visual Prolog | strong | partially implicit | nominal | static |
Wolfram Language | strong | dynamic | ||
Windows PowerShell | strong | implicit | dynamic | |
XL | strong | nominal | static | |
Xojo | strong | explicit | nominal | static |
XPath/XQuery | strong | partially implicit | nominal | dynamic with optional static typing |
Language | Type safety | Type expression | Type compatibility and equivalence | Type checking |
OCaml is a general-purpose, high-level, multi-paradigm programming language which extends the Caml dialect of ML with object-oriented features. OCaml was created in 1996 by Xavier Leroy, Jérôme Vouillon, Damien Doligez, Didier Rémy, Ascánder Suárez, and others.
Java and C++ are two prominent object-oriented programming languages. By many language popularity metrics, the two languages have dominated object-oriented and high-performance software development for much of the 21st century, and are often directly compared and contrasted. Java's syntax was based on C/C++.
C++ is a high-level, general-purpose programming language created by Danish computer scientist Bjarne Stroustrup. First released in 1985 as an extension of the C programming language, it has since expanded significantly over time; as of 1997, C++ has object-oriented, generic, and functional features, in addition to facilities for low-level memory manipulation for systems like microcomputers or to make operating systems like Linux or Windows. It is usually implemented as a compiled language, and many vendors provide C++ compilers, including the Free Software Foundation, LLVM, Microsoft, Intel, Embarcadero, Oracle, and IBM.
ECMAScript is a standard for scripting languages, including JavaScript, JScript, and ActionScript. It is best known as a JavaScript standard intended to ensure the interoperability of web pages across different web browsers. It is standardized by Ecma International in the document ECMA-262.
In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every term. Usually the terms are various language constructs of a computer program, such as variables, expressions, functions, or modules. A type system dictates the operations that can be performed on a term. For variables, the type system determines the allowed values of that term.
In computer programming, duck typing is an application of the duck test—"If it walks like a duck and it quacks like a duck, then it must be a duck"—to determine whether an object can be used for a particular purpose. With nominative typing, an object is of a given type if it is declared as such. With duck typing, an object is of a given type if it has all methods and properties required by that type. Duck typing may be viewed as a usage-based structural equivalence between a given object and the requirements of a type.
In computer science, type conversion, type casting, type coercion, and type juggling are different ways of changing an expression from one data type to another. An example would be the conversion of an integer value into a floating point value or its textual representation as a string, and vice versa. Type conversions can take advantage of certain features of type hierarchies or data representations. Two important aspects of a type conversion are whether it happens implicitly (automatically) or explicitly, and whether the underlying data representation is converted from one representation into another, or a given representation is merely reinterpreted as the representation of another data type. In general, both primitive and compound data types can be converted.
In computer science, type safety and type soundness are the extent to which a programming language discourages or prevents type errors. Type safety is sometimes alternatively considered to be a property of facilities of a computer language; that is, some facilities are type-safe and their usage will not result in type errors, while other facilities in the same language may be type-unsafe and a program using them may encounter type errors. The behaviors classified as type errors by a given programming language are usually those that result from attempts to perform operations on values that are not of the appropriate data type, e.g., adding a string to an integer when there's no definition on how to handle this case. This classification is partly based on opinion.
In computer programming, an entry point is the place in a program where the execution of a program begins, and where the program has access to command line arguments.
Programming languages are used for controlling the behavior of a machine. Like natural languages, programming languages follow rules for syntax and semantics.
Haxe is a high-level cross-platform programming language and compiler that can produce applications and source code for many different computing platforms from one code-base. It is free and open-source software, released under an MIT License. The compiler, written in OCaml, is released under the GNU General Public License (GPL) version 2.
Memory safety is the state of being protected from various software bugs and security vulnerabilities when dealing with memory access, such as buffer overflows and dangling pointers. For example, Java is said to be memory-safe because its runtime error detection checks array bounds and pointer dereferences. In contrast, C and C++ allow arbitrary pointer arithmetic with pointers implemented as direct memory addresses with no provision for bounds checking, and thus are potentially memory-unsafe.
FriCAS is a general purpose computer algebra system with a strong focus on mathematical research and development of new algorithms. It comprises an interpreter, a compiler and a still-growing library of more than 1,000 domains and categories.
Gilad Bracha is a software engineer at F5 Networks, and formerly at Google, where he was on the Dart programming language team. He is creator of the Newspeak language, and co-author of the second and third editions of the Java Language Specification, and a major contributor to the second edition of the Java Virtual Machine Specification.
Go is a statically typed, compiled high-level programming language designed at Google by Robert Griesemer, Rob Pike, and Ken Thompson. It is syntactically similar to C, but also has memory safety, garbage collection, structural typing, and CSP-style concurrency. It is often referred to as Golang because of its former domain name, golang.org
, but its proper name is Go.
Gosu is a statically typed general-purpose programming language that runs on the Java Virtual Machine. Its influences include Java, C#, and ECMAScript. Development of Gosu began in 2002 internally for Guidewire Software, and the language saw its first community release in 2010 under the Apache 2 license.
In computer programming, one of the many ways that programming languages are colloquially classified is whether the language's type system makes it strongly typed or weakly typed. However, there is no precise technical definition of what the terms mean and different authors disagree about the implied meaning of the terms and the relative rankings of the "strength" of the type systems of mainstream programming languages. For this reason, writers who wish to write unambiguously about type systems often eschew the terms "strong typing" and "weak typing" in favor of specific expressions such as "type safety".
Dart is a programming language designed by Lars Bak and Kasper Lund and developed by Google. It can be used to develop web and mobile apps as well as server and desktop applications.
Gradual typing is a type system that lies inbetween static typing and in dynamic typing. Some variables and expressions may be given types and the correctness of the typing is checked at compile time and some expressions may be left untyped and eventual type errors are reported at runtime.