[E-Lang] static typing

Dean Tribble tribble@e-dean.com
Mon, 18 Jun 2001 22:22:07 -0700


>I have wrestled with the question of what to say about static/dynamic
>checking in Walnut at some length. While your discussion here is
>illuminating, it doesn't change the following truth, which is approximately
>what I say in Walnut (in the Introduction) now: you could write a book just
>about the pros and cons of static type checking. E has chosen dynamic type
>checking. Lots of excellent real world software has been written with
>dynamic type checking. If you the reader are a static type checking
>aficionado, all we can say is try E anyway, we think you'll be pleased.

I occasionally hold a much stronger (and occasionally flip) point of view:

Object purist:  the type of an object is what methods it responds to.  If 
an object fails on half the methods in its declared interface (e.g., the 
Java collection classes), they are not of the type specified by that 
interface because they do not uphold the contract of those methods;  a 
client cannot count on their behavior.

Security purist:  believing the type system when it claims "no really, that 
object is money" when strong encapsulation prevents you from seeing inside 
it is well not the type of safe that is important :-)

and most important:

Network purist:  the machine at the other end of a wire is defined entirely 
in terms of its wire protocol, and might be implemented in an entirely 
different language.  Thus, a particular "object" could act like a Foo one 
moment, and a Bar the next.  What was its type again?

All these add up to saying that type checking is to help a programmer make 
their program correct, but that it provides no assurance of actual type 
correctness, security, especially in a distributed system.

Hence, a distributed programming language is either untyped or 
confused.  Which would you rather have?  :-)

BTW Scheme is actually "latently" typed, meaning that the objects have 
inherent types, but they are checked at runtime.  Smalltalk and E have some 
inherent types, but I don't think they quite qualify.  They are in yet 
another category that is more structured than untyped languages such a Perl 
and I think Python.