I saw Martin Odersky's "The Trouble with Types" presenstaion. He divided programing-languages in two dimensions in the "Type Systems Landscape" chart; A "Static/Dynamic" dimension and A "Strong/Weak" one.

I searched to find a definition for "strong/weak type systems" and its difference from "static/dynamic" type-systems that can explain why Python/Ruby have a "strong type system"? I've found something on Wikipedia, but it hasn't satisfied me.

Now I want to know what's the "strong/weak"? and How Python has a strong type system (like as scala)? Is it about inheritance / composable / primitive types in a language or not? If 'no', What's the the concept and measurement-unit for these features (inheritance / compose / primitive / container / ...) in the type-systems?

  • 2
    Start here: en.wikipedia.org/wiki/Strong_and_weak_typing Sep 2, 2014 at 17:45
  • 3
    You mention that wikipedia hasn't satisfied you - why not? What don't you understand? Furthermore, give Discuss this ${blog} a read. Realize that Martin's definition may be controversial (the 'strong weak' thing is poorly defined).
    – user40980
    Sep 2, 2014 at 17:52
  • I saw it but it couldn't satisfied me. I need a better resource than wikipedia; and also clearer explanation. Sep 2, 2014 at 17:54
  • 1
    What don't you understand about it?
    – user40980
    Sep 2, 2014 at 17:54
  • @MichaelT I'm torn between upvoting the OP, because per Lippert's comment this dichotomy is completely ridiculous, but upvoting you, because, as nonsensical as the Wiki article is, the OP should be able to say that. e.g. "it just lists a bunch of different characteristics but doesn't say which ones make a language strong/weak typed".
    – djechlin
    Sep 2, 2014 at 18:04

2 Answers 2


A strong type system is a type system that has a compile-time restriction or run-time feature that you find attractive.

A weak type system is a type system which lacks that restriction or feature.

Seriously, that's it. You read the Wikipedia page, so you know that there are at least eleven different mutually incompatible meanings of "strongly typed". The term is useless unless clarified; no two people discussing a type system need have the same definition in their heads of "strongly typed".

The sensible thing to do is therefore to avoid using "strong" and "weak" entirely; when you talk about a feature of a type system, simply describe the feature rather than characterizing it as "strong" or "weak". If you mean "I like languages where the compiler assigns static types to expressions and searches for type errors" then say that. If you mean "I like languages where every object has one or more associated data types and can describe those types reflectively at runtime" then say that. Don't say "strong" because someone will think you mean "statically typed" and someone will think you mean "has run-time reflection", and those two things have pretty much nothing to do with each other.

Keep in mind also that many people use "strong" to mean that a particular type system restriction is impossible to ignore, and some use "strong" to mean the opposite: that a restriction is encouraged but can be avoided. For example, someone who believes that a type system is "strong" if type errors are impossible at runtime would characterize C# as "weakly" typed, because C# allows the developer to insert type conversions that will fail at runtime. (example: short x = (short)(object)(123.ToString());) Someone who believes that a type system is "strong" if it encourages writing programs where the compiler finds many but not all type errors at compile time would characterize C# as strongly typed for the same reason. If the same feature of the type system can be reasonably characterized as both "strong" and "weak" then we know that the terms are useless and should be avoided.

  • 1
    +1, beat me to it. Surprised that the founder of Scala is so loose with this.
    – djechlin
    Sep 2, 2014 at 17:59
  • It would be intriguing to do a radar chart for each of the strong/weak definitions as a spoke for a given language. Not that it solves the problem but rather sheds more light on it that its not well defined though still allows one to compare two languages.
    – user40980
    Sep 2, 2014 at 18:21
  • @MichaelT I think at the end of the day people are almost always using "strong" to refer to "at some point before it dereferences a member of an instance, it will do a form of type checking to know if it should even try" - which is a req filled by many type system features, but when people say "strong" they usually mean a certain specific type system which they inaccurately assume is analogous with 'strong' Sep 2, 2014 at 19:08
  • @JimmyHoffa: What does "members of an instance" have to do with it? A language need not even have the concepts of "members" and "instances" -- C has no such concept, but C has a type system. Sep 2, 2014 at 19:45
  • 1
    Sorry, the better phrasing would be "before it dereferences something" -> It seems odd to say C has no instances - I understand they're not .NET instances but I would submit the term simply refers to ∀ types. instance ∈ types. - so given the data has a type, any value with or without type information is an instance of a type. I recognize that doesn't fit the nominal inequality identical values from different types are supposed to have. Is it inaccurate to think a value is an instance of a type when it doesn't have any runtime type information - existing as a free value ? Sep 2, 2014 at 20:13

In a nutshell, the strength of a type system is how likely you are to get a type mismatch error when you try to do things in the language. Strongly typed languages have lots of ways to get a type mismatch error: wrong type passed into or out of a function, wrong type assigned to a variable, wrong type on one side or the other of an operator. Strongly typed languages let you create your own types with similar restrictions. Weakly typed languages try to avoid type mismatch errors. That doesn't mean variables in weakly typed languages don't have types, just that the language doesn't help the programmer automatically check and enforce those types.

Strong typing is a continuum, not an absolute. Even strongly typed languages carve out exceptions. Java does type coercion between numeric types and from most types to a String, for example. Some language features like type inference or implicits give a superficial appearance of weaker typing, but are still very strong behind the scenes. There is no bright dividing line, but usually it's relatively easy to compare two languages with each other. You might call C++ strongly typed compared to JavaScript, but not compared to Haskell, for example.

The term is often mistakenly used to mean how expressive a type system is, but that's a separate metric. It's also often mistaken with static typing, which is a measure of how much the types are checked at compile time versus runtime.

  • 2
    In Java "3" + 1 is "31". Are you saying that Java is weakly typed?
    – user40980
    Sep 2, 2014 at 18:10
  • 2
    I would not call C++ strongly typed because by "strongly typed" I might choose to mean "every object has a type and can describe that type at runtime", which is not true of all implementations of C++. That is true of JavaScript, so JavaScript is strongly typed and C++ is weakly typed. Sep 2, 2014 at 18:10
  • 2
    Yes, @MichaelT, that makes Java more weakly typed than other languages for which that is a type mismatch, or for which that conversion being available or not can be explicitly controlled by the programmer. That doesn't mean it's the weakest typed language out there. The term is almost meaningless as an absolute. Sep 2, 2014 at 18:57
  • 2
    A weakly typed language will let you do it, either by turning the string into a number and doing addition, or by turning the number into a string and doing concatenation (hopefully with predictable results)”. This is only true if your definition of “weak typing” means “a type system with implicit coercions”. Note that such coercions can be well-defined and consistent. Scala's wonderful type system, for example, includes implicit functions that can perform conversions where needed.
    – amon
    Sep 2, 2014 at 19:36
  • 1
    You guys are getting hung up on my example, which only shows one part of the picture. I'm not saying that any type coercion automatically makes a language weakly typed. I'm saying it's a visible factor into where a language fits on the spectrum. Java has very limited type coercion: some numeric types, and most everything to a String. Scala is actually much more strict in the language itself. Its implicit conversions are all explicitly specified in the standard library, within the type system. JavaScript coerces all over the place, whether you want it to or not. Sep 2, 2014 at 21:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.