What makes a language strongly typed? I'm looking for the most important aspects of a strongly typed language.
Yesterday I asked if PowerShell was strongly typed, but no one could agree on the definition of "strongly-typed", so I'm looking to clarify the definition.
Feel free to link to wikipedia or other sources, but don't just cut and paste for your answer.
The term "strongly typed" has no agreed-upon definition.
It makes a "great" argument in a flamewar, because whenever someone is proven wrong, they can just redefine it to mean whatever they want it to mean. Other than that, the term serves no real purpose.
It is best to just not use the term, or, if you use it, rigorously define it first. If you see someone else use it, ask him to define the term.
Everybody has their own definition. Some that I have seen are:
In Type Theory, there exists the notion of one type system being stronger than another. In particular, if there exists an expression e1
such that it is accepted by a type system T1
, but rejected by a type system T2
, then T2
is said to be stronger than T1
. There are two important things to note here:
According to B.C. Pierce, the guy who wrote "Types and Programming Languages and Advanced Types and Programming Languages" :
I spent a few weeks trying to sort out the terminology of "strongly typed," "statically typed," "safe," etc., and found it amazingly difficult... The usage of these terms is so various as to render them almost useless.
So no wonder why your collegues disagree.
I'd go with the simplest answer : if you can concatenate a string and an int without casting, then it's not strongly typed.
EDIT: as stated in comments, Java just does that :-(
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With