What is a type error?

Darren New dnew at san.rr.com
Mon Jul 17 12:49:31 EDT 2006


Chris Smith wrote:

> Darren New <dnew at san.rr.com> wrote:
> 
>>I'm not sure what linear or uniqueness typing is. It's typestate, and if 
>>I remember correctly the papers I read 10 years ago, the folks at 
>>TJWatson that invented Hermes also invented the concept of typestate. 
>>They at least claim to have coined the term.
> 
> Coining the term is one thing, but I feel pretty confident that the idea 
> was not invented in 1986 with the Hermes language, but rather far 
> earlier.

Yes. However, the guys who invented Hermes didn't come up with it out of 
the blue. It was around (in NIL - Network Implementation Language) for 
years beforehand. I read papers about these things in graduate school, 
but I don't know where my photocopies are.

NIL was apparently quite successful, but a niche language, designed by 
IBM for programming IBM routers. Hermes was an attempt years later to 
take the same successful formula and turn it into a general-purpose 
programming system, which failed (I believe) for the same reason that a 
general purpose operating system that can't run C programs will fail.

> Perhaps they may have invented the concept of considering it 
> any different from other applications of types, though.  

 From what I can determine, the authors seem to imply that typestate is 
dataflow analysis modified in (at least) two ways:

1) When control flow joins, the new typestate is the intersection of 
typestates coming into the join, where as dataflow analysis doesn't 
guarantee that. (They imply they think dataflow analysis is allowed to 
say "the variable might or might not be initialized here", while 
typestate would ensure the variable is uninitialized.)

2) The user has control over the typestate, so the user can (for 
exmaple) assert a variable is uninitialized at some point, and by doing 
so, make it so.

How this differs from theoretical lambda types and all I couldn't say.

> What is being named here is the overcoming of a limitation that 
> programming language designers imposed upon themselves, whether from not 
> understanding the theoretical research or not believing it important, I 
> don't know.

I believe there's also a certain level of common-senseness needed to 
make a language even marginally popular. :-)  While it's possible that 
there's really no difference between type and typestate at the 
theoretical level, I think most practical programmers would have trouble 
wrapping their head around that, just as programming in an entirely 
recursive pattern when one is used to looping can be disorienting.

-- 
   Darren New / San Diego, CA, USA (PST)
     This octopus isn't tasty. Too many
     tentacles, not enough chops.



More information about the Python-list mailing list