On 9/27/05, Erik de Castro Lopo <[EMAIL PROTECTED]> wrote:
> 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.

Modern VMs (e.g. many of the Smalltalk VMs) dynamically compile code,
i.e. they JIT.  The more sophisticated ones use type inferencing to
tighten up the compiled code at runtime.  This adds the runtime
benefits of having type information to the coding time benefits of
dynamic typing.  In fact, the very best of the JITing VMs can get
performance that exceeds that attainable by static compilation -
because there is more information available at run time to base the
tuning decisions upon.

The down side to JITing is that there is a start-up cost.  Every time
a program starts, the process of compiling and tuning begins. 
Statically compiled code is therefore much faster out of the blocks. 
This is very much like the story of the tortoise and the hare - the
quality JIT will overtake the statically compiled code, but whether it
will do it before the end of the race depends on the length and nature
of the race.

Horses (or tortoises) for courses.

Of course, languages like Ocaml bring bring significant coding time
benefits to the table too!  The declarative nature of Objective Caml
suits some kinds of problems really well.

> 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.

Given a sane programmer - yes.  There are ways to create new root
classes, but anyone doing this in code destined for a production
environment should scolded, and perhaps even spanked.

> 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.

Exactly

All the best,
     Bruce
--
Make the most of your skills - with OpenSkills
http://www.openskills.org/
--
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