What is “strong/weak”-typing?

Sherub Thakur
2 min readJul 26, 2023

The phrases “strongly typed” and “weakly typed” are often used to mean so many different things that it can be hard to disambiguate what the author might mean when they are using these terms without context. This is something even academic papers are at fault there, not just your run-of-the-mill articles floating around on the internet.

Stand-ins for statically-typed and dynamically-typed

Weakly typed means dynamically typed.
Strongly typed means statically typed.

How permissive a type system is

In this context weakly-typed means a language implementation that allows for a lot of automatic coercions, whereas strongly-typed (in this context) means that the language implementation disallows them as much as possible. This is scale rather than either-or case.

Memory behaviour (rare)

Weakly-typed here means that language can have undefined behaviour in terms of memory safety where as strongly typed here means that the language has memory safe behaviour (most of the times). This is a scale rather than either-or case. In discussion we usually tend to gloss over FFI when using this definition.

Feature Richness of a Type System

Weakly typed here corresponds to something that offers a relatively limited static type system. Where as strongly-typed would mean that the language has a very rich static type system. So all dynamically typed languages would be weak, plus some languages like C and pascal would also be weakly-typed (according to this definition).

Effect Tracking (extremely rare)

Weakly typed (in this context) means the type-system can’t track effects whereas strongly typed means that it can.

Bucketing a few languages

Let’s try to bucket a few languages (C, JS, Python, Java, Clojure, Haskell) using these definitions.

| Definition          | C      | JS     | Python | Java   | Clojure | Haskell |
| --------------------| ------ | ------ | ------ | ------ | ------- | ------- |
| Static/Dynamic | Strong | Weak | Strong | Weak | Strong | Strong |
| Permissiveness (1) | Weak | Weak | Strong | Weak | Strong | Strong |
| Memory Behaviour (2)| Weak | Strong | Strong | Strong | Strong | Strong |
| Feature Richness (3)| Weak | Weak | Weak | Strong | Weak | Strong |
| Effect Tracking | Weak | Weak | Weak | Weak | Weak | Strong |
  1. This one is a scale, so it’s hard to hand out certificates of being weak or strong. E.g. We can say python is strongly-typed in (i.e. its type system is less permissive than let’s say Java). I am converting this scale into 2 buckets, so I have used the marking a line at the halfway point (more or less).
  2. Here consideration is on most canonical features excluding escape hatches like FFI etc.
  3. Feature Richness of the static type system. All dynamically typed become weakly typed no matter how rich their type-system might be at runtime.

Conclusion

As we can see languages jump camps based on the definition used, resulting in endless confusion to readers. This is reason enough to just avoid these terms altogether.

--

--