On 12/09/2006, at 3:39 PM, Malcolm V wrote:

Of course, for quick off the cuff things, dynamic typing
is a god-send and no-one has to think too hard, especially the twit that
lets it slip into a production environment.

I think dynamic typing's actually a total cop-out. There is exactly one sceneario where dynamic typing is necessary and useful, which is when you are loading unknown code at run-time (e.g. plugins) and you have no idea what that code could potentially do. Dynamic typing is useful there since you're actually doing type-checking of the code you're loading and ensuring that it's at least of the correct type[1].

Advocating the use of dynamic typing as a standard language feature means that you don't care at all about catching bugs early in development. IMHO a language with dynamic typing has been designed by someone who doesn't know much about programming language theory (I'm looking at you, Guido van Rossum), or someone who's just plain lazy. Why on Earth should the expression

  "foo" + 5

compile? (Excluding all you miscreants who think that the resulting string should be "foo5": if you belong in that crowd, you can stick with your nonsensical Javascript type conversions where adding "1" and 1 will give you the answer to a kid's riddle. What, you expected Javascript to give you an error there?)

Objective-C is proof that you can mix both static typing with dynamic typing and build robust, reliable applications that are easily extensible. Opting for zero type-checking during the compile phase is simply due to stupidity or laziness on the language designer's part.

1. One other often-quoted scenario where dynamic typing is necessary is if you're serialising/marshalling data to/from a network or disk. That isn't a dynamic typing problem: that's a parsing problem.


--
% Andre Pang : trust.in.love.to.save  <http://www.algorithm.com.au/>



_______________________________________________
coders mailing list
[email protected]
http://lists.slug.org.au/listinfo/coders

Reply via email to