Strong vs Weak Typing
As someone that has used strongly typed programming languages for most of his short career, I’m finding it hard to grasp the advantages of weakly-typed ones.
Paul Vick makes a good point when he says that generics make strongly typed languages even stronger, and this seems to go straight against the new wave of weakly typed languages like Python and older ones like Smalltalk.
It seems somewhat related to the enabling vs. directing thread that was going around recently. Strongly typed languages direct you down an inflexible path: you may only assign a value of type A to a variable of type A or one of its superclasses or interfaces. Once you do that it may be painful to change the type later in the code because you have to edit all of the types. Weakly typed languages enable agile processes where a value’s type may change often and variables don’t have type. Good unit testing with weakly typed languages prevents programmers from making mistakes with types.
Refactoring support in IDEs like Eclipse digs into this advantage of weak typing though. If I can change the strong type of a variable everywhere in the code with one action then isn’t this the same difficulty as changing a weak type except now I have a more rigid type contract? If the tools enable the same type flexibility as weakly typed languages wouldn’t a strongly typed language be better?
Maybe I need a few examples. I haven’t seen the light yet.