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 | |||
AutoHotkey | typeless | — | — | — |
AutoLISP | dynamic | |||
Ateji PX | strong | explicit | nominal | static |
AWK | ? | ? | ? | ? |
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 |
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 |
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 among composites | 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 appeared about 10 years later and its syntax was based on C/C++.
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 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. Type systems formalize and enforce the otherwise implicit categories the programmer uses for algebraic data types, data structures, or other components.
Duck typing in computer programming 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 to be. In duck typing, an object is of a given type if it has all methods and properties required by that type. Duck typing can be viewed as a usage-based structural equivalence between a given object and the requirements of a type. See structural typing for a further explanation of structural type equivalence.
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.
C# is a general-purpose high-level programming language supporting multiple paradigms. C# encompasses static typing, strong typing, lexically scoped, imperative, declarative, functional, generic, object-oriented (class-based), and component-oriented programming disciplines.
Scala is a strong statically typed high-level general-purpose programming language that supports both object-oriented programming and functional programming. Designed to be concise, many of Scala's design decisions are aimed to address criticisms of Java.
In computer science, a type system is a nominal or nominative type system if compatibility and equivalence of data types is determined by explicit declarations and/or the name of the types. Nominal systems are used to determine if types are equivalent, as well as if a type is a subtype of another. Nominal type systems contrast with structural systems, where comparisons are based on the structure of the types in question and do not require explicit declarations.
Haxe is an open source 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 the MIT License. The compiler, written in OCaml, is released under the GNU General Public License (GPL) version 2.
TypeScript is a free and open source high-level programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language. It is designed for the development of large applications and transpiles to JavaScript. As it is a superset of JavaScript, existing JavaScript programs are also valid TypeScript programs.
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 with 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.
Rust is a multi-paradigm, high-level, general-purpose programming language. Rust emphasizes performance, type safety, and concurrency. Rust enforces memory safety—that is, that all references point to valid memory—without requiring the use of a garbage collector or reference counting present in other memory-safe languages. To simultaneously enforce memory safety and prevent concurrent data races, Rust's "borrow checker" tracks the object lifetime of all references in a program during compilation. Rust is popular for systems programming but also offers high-level features including some functional programming constructs.
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. The programming language is designed for client development such as for the web and mobile apps, and it can also be used to build server and desktop applications.
Gradual typing is a type system in which 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. Gradual typing allows software developers to choose either type paradigm as appropriate, from within a single language. In many cases gradual typing is added to an existing dynamic language, creating a derived language allowing but not requiring static typing to be used. In some cases a language uses gradual typing from the start.
Angular is a TypeScript-based, free and open-source web application framework led by the Angular Team at Google and by a community of individuals and corporations. Angular is a complete rewrite from the same team that built AngularJS. Angular is a Single Page Application Framework which is used for creating Fast Web Applications. It uses concepts of SPA in which UI is delivered in the beginning of application request and later only data is requested which makes SPA applications fast.