[E-Lang] static typing

hal@finney.org hal@finney.org
Tue, 19 Jun 2001 08:32:43 -0700


Dean writes:
> 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.

One of the points that was made earlier is that sometimes objects
"accidentally" respond to the same messages even though they aren't
the same type.  One of the attacks I posted a few months ago to the
MintMaker code relied on the fact that purses and assays both responded
to the vouch message.  Particularly in the context of security analysis,
this can be a dangerous trap.

A (conceptually) simple way around this would be to allow objects to have
named types, where the type name is used only to provide a namespace for
the messages.  Conceptually you would concatenate the type name with the
specified message name to generate the true message name that was used
internally.  So if you had a method that took a paramter which was of type
Assay, and called vouch on it, the true message name would be Assay_vouch.
This message would not be responded to by an object of type Purse, and
you would eliminate one possible cause of errors in your program.

I realize that this would be a big change to E.  You could of course get
the same effect via a programming discipline of naming your messages in
this way.

Hal