From: Joel VanderWerf Date: 2003-04-12T13:40:07+09:00 Subject: Re: Does dynamic typing make it easier to place an object in a container? Mark Wilson wrote: > The following is from > http://www.wikipedia.org/wiki/Objective_C_programming_language > > Is this a correct statement about the value of dynamic typing? And what > exactly does it mean? > > "However when one does need dynamic typing, it becomes tremendously > powerful. Consider a simple example, placing an object in a container. > In strongly-typed [sic] languages like C++ and Java, the programmer is > forced to write a container class for a generic type of object, and then > cast back and forth between the abstract generic type and the real type > (C++ can also use templates, but many find these somewhat cumbersome and > obscure). Sadly, casting breaks the discipline of strong typing -- if > you put in an Integer and read out a String, you get an error. This is > annoying when you consider that it was a string when you put it in there > three lines earlier, and now you have to tell the compiler that it's a > string coming back out just to call toUpperCase(). Dynamic typing > thankfully removes this problem." For a great explanation, see Pragmatic Dave's article at: http://www.pragmaticprogrammer.com/cgi-local/pragprog?JavaIsUntyped