Types in Languages

Unfortunately types and how programming languages enforce and treat types have turned into a mess of buzzwords. Many times the phrases "dynamic typing", "untyped", "weakly typed", and especially "strongly typed" are abused.

Let's start from the basics and work our way around what types are, and how programming languages treat types. This list isn't comprehensive just an overview of what exists.


Languages can have one type (untyped), multiple types (typed) of any kind, multiple types that only apply to values (latently typed), multiple types which are applied to variables, or any combination of these. Really this list could add multiple types which are applied to any part of a language.

To sum up: untyped languages have values which are all one type, where as typed languages have values which have more than one type.

Type Checking

If a language has types, it can choose to enforce its types at compile time, runtime, never, or some combination of those.

Type Coercion

Some languages allow types to be used loosely (passing an int for a string to print, may print the int as if it were a string )

Languages can either have no coercion, some coercion, or unrestricted coercion.

Type Enforcement

Types can be enforced based on only their type names (nominal typing), if the code (structural typing)

But what about "dynamic typing", "strongly typed", etc..?

Notice how there was no mention of the words static typing , dynamic typing , weakly typed , and strongly typed . This is on purpose.

Those phrases can be misleading and should be used with caution. There is mass confusion around these terms, and even those who write tutorials are incorrect about them. Each of these phrases are a certain combination of the features I've listed above.

I mainly have issues with two of these phrases: "dynamic typing" and "strongly typed"

What's wrong with the phrase "dynamic typing"?

In short: dynamic typing is associated with irrelevant things, and has bunch of different definitions.

One of those "irrelevant things" is how dynamic typing is associated with duck typing.

Duck typing could be implemented by either no type checking, allowing implicit type coercion. It has nothing to do with runtime type checking.

Often times Ι hear the phrase "dynamic typing" extended to say "dynamic languages". This doesn't help the already confusing situation.

What's wrong with the phrase "strongly typed"?

The phrase strongly typed is the worst offender of buzzwordification .

This is being seriously butchered by Microsoft/.NET fanboys and girls. Many .NET libraries have "strongly typed" varieties, or include something something "strongly typed".

Strongly typed typically means there is very little to no implicit type coercion. But it has been used to mean anything which uses types in anyway.