|
|
|
|
|
by hyperpape
3778 days ago
|
|
I happen to think that there are meaningful things you can express by saying "Strong Typing" or "Weak Typing" (https://news.ycombinator.com/item?id=9256695), though "well defined" might be stretching it. However, I don't like this definition at all. Both JavaScript and Python prohibit operations on types that don't support them. They both have TypeErrors (or something similar) that are thrown at runtime for certain operations, while others produce a result. The difference is just that JavaScript allows a bunch of operations that Python prohibits, including several that serve almost no purpose. Is allowing 1 + "1" allowing an operation on a type that doesn't support it, or does your language just allow adding numbers and strings? There is no principled way to answer that question. |
|
That litmus test is probably not enough to make a true formal definition, but does allow you to make objective comparisons between languages for certain operations.