[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Strong Typing, Dynamic Languages, What to do?

> -----Original Message-----
> From: Noel Welsh [mailto:noelwelsh@yahoo.com]
> Sent: Friday, March 22, 2002 11:52 AM
> To: Jerzy Karczmarczuk
> Cc: PLT-Scheme
Jerzy Says:
> > For people who *seriously* pose themselves the
> > question which type system (or lack thereof) use
> > in practical programming, independently of the human
> > side of the affair, of the ergonomics, of debugging,
> > etc. there is also a question of brutal efficiency.

Noel Says:
> Agreed.  Brent knows his way around a compiler so he's
> aware of the issue.  That said if your Scheme has a
> module system and/or no load or eval then you can in
> theory compile away lots of those type checks. If you
> choose to write in a style that matches what the type
> inference algorithm can infer then you can compile
> away all of those checks.  Stalin in an example of
> such a system as is the compiler I intend to write
> someday ;)

Noel is a bit too kind to me with respect to any supposed
compiler knowledge ;-), however I do admit to being aware
of the efficiency aspects.

Matthias has already made an accurate (though scathing)
observation about the efficiency of two of the strong
type system poster-children (SML and Haskell).  And
certainly it does seem that these two systems, which should
possess sufficient information to produce highly optimized
code certainly do not, while the softly-typed CMUCL can
produce blazing-fast code.

So, clearly type annotations are not sufficient in and of
themselves to optimize code.

But I worry more about logical errors, which are generally
more costly than simple efficiency, both in speed and in
lost work.  An anal-retentive type system seems to be better
at enforcing the contracts of your method signatures -- as
long as your type system accurately represents your problem