Bruce Badger wrote:

> Nah.  In fact the oposite is true.  Static typing is just another form
> of premature optimisation!

There are large classes of problems where running speed is an
important issue. Static typing does make for faster run times
and in cases where that moves your program from being too
slow to being fast enough, that is not a premature optimisation.

> I make extensive use of dynamically typed languages (Smalltalk mostly)

Smalltalk is actually one of the more sane dynamically typed languages
and one of the few where the above comment actually makes sense.

Correct me if I'm wrong, but my understanding of Smalltalk is that 
all objects live in a class heirarchy that inherits from a base
class. That means that given an operation on two objects A and
B that is not defined on A and B, then the runtime system can 
walk back along the class heirarchy of both A and B until (hopefully)
it finds parent classes of A and B that do allow the required 
operation.

However, other dynamically typed languages like Python, php and to a 
lesser extent Perl do not have anywhere near as sane a system. I 
suspect that the Smalltalk equivalent of the following Python code
might actually do the right thing:

    a = [ 1, "help" ]
    b = a + 10
  
but Python squeals like a stuck pig (read runtime error).

> and the class of problem one might imagine that static typing save you
> from I just don't encounter in practice.

My criticisms of dynamic typing are particularly aimed at the most 
commonly used dynamically typed languages which means Python, PHP
and Perl.

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo
+-----------------------------------------------------------+
C++: The power, elegance and simplicity of a hand grenade.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to