language-agnostictypesstrong-typingdynamic-typingweakly-typed

Advantages of Weak Typing over Strong Typing


So, I've read a bunch of similar questions on Stack Overflow regarding this issue, and I think I have a good grasp of what the differences between the two are. My question is whether there is any advantage of weak typing over strong typing beyond the fact that some operations are simply easier for programmers. While I agree that some operations between types are unnecessarily complicated by strongly typed languages, it seems like everything that a weakly typed language can still be done in a strongly typed language with some extra baggage.

Personally, I would probably prefer the extra safety of strong typing and deal with minor annoyances for certain operations, but is there any advantage of weak typing beyond that? Is there something that strong typing could never do the same way?


Solution

  • Some languages offer concepts to alter an object's or class' behavior on runtime: An object that does not implement a method might decide to find a way to respond to the method call nevertheless.

    In Objective-C delegation is a common way to let another object respond to a client's message. Objects can detect the missing implementation and pass the method call on to a delegate. It's also possible to dynamically add the implementation of a method when it gets called.

    These concepts are based on dynamic method lookup, rather than weak vs. strong typing. But weak typing is tightly coupled with dynamic lookup, so I think this counts as an advantage.