Python from Wise Guy's Viewpoint

Fergus Henderson fjh at cs.mu.oz.au
Mon Oct 27 12:27:11 EST 2003


Pascal Costanza <costanza at web.de> writes:

>In a statically typed language, when I write a test case that calls a 
>specific method, I need to write at least one class that implements at 
>least that method, otherwise the code won't compile.

No -- you don't need to implement the method.  You only need to declare it.

Even the need to declare it is really just a property of implementations,
not languages.

>Well, the research that ultimately lead to the HotSpot Virtual Machine 
>originated in virtual machines for Smalltalk and for Self. Especially 
>Self is an "extremely" dynamic language, but they still managed to make 
>it execute reasonably fast.

Please correct me if I'm wrong, but as I understand it, iterating over a
collection of values is still going to require keeping some representation
of the type of each element around at runtime, and testing the type for
each element accessed, in case it is not the expected type.  AFAIK neither
HotSpot nor the Self compiler do the kind of optimizations which would
be needed to avoid that.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.




More information about the Python-list mailing list