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

Re: dynamic vs. static typing




"Anton van Straaten" <anton@appsolutions.com> replies to Joe Marshall
on the reasons for static dyping in a dynamically typed world:
> > The answer, of course, is that the sooner you find out something,
> > the better.
> >
> > So it is a tradeoff:  reduced language power vs. redundant
> > analysis vs. early answers.
> 
> One way to address this tradeoff is with optional early analysis that warns
> rather than prevents.

One thing that nobody in this debate has mentioned so far:

Even in a dynamically typed world it is possible to design our
language so that it is easy to do partial type inference.  For most
dynamically-typed languages, though, this has not been a priority
(Lisp and its ken come to mind particularly quickly here).  The result
is that when we try to build a static checker, we have to invent a
nasty-looking, impenetrable mess of a "type system" and graft it
frankenstein-like onto the existing language syntax.  The result is
ugly, unusable, and ought to satisfy no one.

The lesson?  Someday, someone will want to try to find errors
statically.  Regardless of what we think of static typing, as language
designers we must actually think a little if we want to make that
process as painless as possible.  Type declarations and type inference
are a way to do this which language designers generally understand and
programmers are willing to accept.

-Jan-Willem Maessen
jmaessen@alum.mit.edu