Strongly-typed programming language
In computing, the phrase strongly-typed, when applied to a
programming language, may have one of several incompatible meanings,
depending on context. Some of the meanings that have been ascribed to this epithet include:
- A language is strongly typed if type annotations are associated with variable names, rather than with values. If types are attached to values, it is weakly typed.
- A language is strongly typed if it contains compile-time checks for type constraint violations. If checking is deferred to run time, it is weakly typed.
- A language is strongly typed if it contains compile or run-time checks for type constraint violations. If no checking is done, it is weakly typed.
- A language is strongly typed if conversions between different types are forbidden. If such conversions are allowed, it is weakly typed.
- A language is strongly typed if conversions between different types must be indicated explicitly. If implicit conversions are performed, it is weakly typed.
- A language is strongly typed if there is no language-level way to disable or evade the type system. If there are casts or other type-evasive mechansisms, it is weakly typed.
- A language is strongly typed if it has a complex, fine-grained type system with compound types. If it has only a few types, or only scalar types, it is weakly typed.
- A language is strongly typed if the type of its data objects is fixed and does not vary over the lifetime of the object. If the type of a datum can change, the language is weakly typed.
Note that some of these definitions are contradictory, while others are merely orthogonal.
Because there is no generally-agreed meaning for the phrase "strongly-typed langauge",
it is possible to find authoritative statements that many languages both are and
are not strongly-typed. For example, under definitions 1, 2, 3, and 8, the C language
is strongly typed; under 4, 5, and 6 it is weakly typed. Accordingly, it is
easy to find people who will claim that C is a "strongly-typed language" and others
who will claim that it is a "weakly-typed language".
Programming language expert datatypes and
its related topics.