Static Typing

Static typing is very often misunderstood to mean that values are associated with types at CompileTime, when instead it means that that a ReferenceValue is manifestly (which is not the same as at CompileTime) constrained with respect to the type of the value it can denote, and that the language implementation, whether it is a compiler or an interpreter, both enforces and uses these constraints as much as possible.

An example of the use of static (manifest) type constraint by the is the ability to allocate exactly the right amount of memory to a variable, and another is the ability to disambiguate overloaded function calls in many cases.

Some languages allow associating constraints other than type based ones on the values that may be denoted by a reference, but this is uncommon.

TypeInference makes many/most/all type declarations unnecessary if the TypeSystem of your ProgrammingLanguage is strong enough.

However even when not necessary, type constraints can be very valuable in documenting assumptions and intentions.

Static typing is often confused with StrongTyping. Also see DynamicTyping and SoftTyping.


It's worth noting that modern hardware is somewhat statically typed. In particular, the set of operations that can be done on a value (defining that variable's type) depends on the variable that refers to it. i.e:

Now, there are few hardware-defined types on most platforms. Integer and address are often the same hardware type; segments are sometimes their own type, when they exist; floats are usually their own; vectors are their own type (or multiple types on x86). --AdamBerger


Languages or compilers that use static typing:


See DefinitionsOfTypes


CategoryLanguageTyping


EditText of this page (last edited August 28, 2008) or FindPage with title or text search