Types Of Typing

Consider merging this page with TypingQuadrant

TypingQuadrant seems to be about classification of languages; TypesOfTyping seems to be about defining the terms.

Actually TypingQuadrant was meant to be about defining the terms through the classification of languages. And if you're looking for good definitions there's always LucaCardelli's paper on the subject: http://citeseer.nj.nec.com/cardelli97type.html See CardelliTypeTerminology


No one seems to be able to completely agree to what they are or how they are defined. But here's a stab at it, trying to be simple:

StaticTyping
Types are checked by the compiler.
DynamicTyping
Types are checked at run-time.
StronglyTyped
Run-time type errors either cannot occur or cause well-defined behavior, except for "loopholes".
StronglyTypedWithoutLoopholes
Run-time type errors either cannot occur or cause well-defined behavior, always.
WeaklyTyped
Run-time type errors can occur and cause UndefinedBehavior.
NominativeTyping?
Types of values are differentiated by programmer-specified names (two differently-named types which are arrays of 5 ints are differert types).
StructuralTyping
Types are defined by the structure of values (two differently-named types which are arrays of 5 ints are the same type). See NominativeAndStructuralTyping.

I do not think that upcasting constitutes a change of type, but downcasting certainly does. TypeInference is a separate issue; like optimization I'd consider it a compiler feature rather than a language feature. Type inference is definitely a language issue, since it dictates where type information must be written or can be elided in the source text.

There are three axes here: static-dynamic, strong-weak and nominative-structural. You can choose to look at each as boolean (either types can be changed or they can't) or a continuum. When considering whether a language has any of these attributes, it may be most productive to consider not just what is possible in a language, but what is encouraged.


Other type terms that need simple definitions:


CategoryLanguageTyping


EditText of this page (last edited January 29, 2005) or FindPage with title or text search