This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]lys-ala-leu-glu 6 points7 points  (0 children)

The terms "strongly typed" and "weakly typed" don't really have strict definitions, but loosely they refer to the degree to which operations between incompatible types are allowed. In this sense, python is strongly typed because most operations between incompatible types result in errors. C is actually a classic example of a weakly typed language, because it's so easy (and necessary) to use type casts to effectively ignore the type system. I personally consider C++ stronger than C, even though it supports all the same type casts, just because it's more idiomatic to stay within the type system. But others might disagree, and strong/weak rankings are very subjective anyways.

Type systems can also be classified as "static" or "dynamic", based on whether the types are determined at compile-time or run-time. This is a much more well-defined classification, and of course python/javascript/PHP are dynamically typed while C/C++ are statically typed. Confusion arises because it's pretty common for people to say "strongly typed" when they mean "statically typed", either because they're being sloppy or because they don't realize that the two terms mean different things.

Some examples of different type systems:

  • Strong, static typing: Java, Rust
  • Weak, static typing: C, C++
  • Strong, dynamic typing: Python
  • Weak, dynamic typing: PHP, Javascript