[E-Lang] down with 'define'

Ralph Hartley hartley@aic.nrl.navy.mil
Wed, 07 Mar 2001 10:07:04 -0500


Mark S. Miller wrote:

> Although in most ways I dearly love Scheme, both Lisp and Scheme are 
> disasters in this regardmity compared to this otherwise god-like language.

Lisp is old, and has grown by accretion. That's why you need a new 
language. And a simple, easy to live with, rule would help keep 
exceptions form sticking.

> 
>> Top level classes are required to be in separate files, so ordering between them is not defined, but classes local to another class don't care about order.
> 
> I believe this last is where there's a substantive difference between Java 
> and E.  Java's named nested and inner classes correspond to E's object 
> definitions.  To all you Java programmers: If named nested and inner classes 
> required forward references in order to be mutually recursive, how bad would 
> that be?

I have to admit that I had to check what java did. But nested and inner 
classes are rare. If object definitions are common, it will matter more.

> Ok, I have a concrete proposal to put on the table:
> 
> Make E scopes truly order independent, in the way Joule's are.  If a 
> defining occurrence of "foo" appears anywhere in the top level of a scope 
> box (that is, in the scope box but not in a nested scope box), the any use 
> of "foo" anywhere in that scope box (including nested scope boxes that don't 
> shadow "foo") corresponds to that defining occurrence.
> 
> Of course, like Joule, E isn't in the bind you point out above that Java 
> would be were it to make this decision.  If the variable is used before its 
> initialized its value is a promise for what it will be initialized to.  Once 
> it's initialized, all these promises resolve to this initial value.
> 
> This proposal makes me queasy, but it's simpler than what we've got, and I 
> don't actually see anything wrong with it yet.

I believe that this proposal is exactly what I would like.

> 
>> Is definition in E really assignment? That is is
>> 
>> startofblock
>> def foo fi[r]stdef
>> ... uses foo ... (firstdef is used)
>> def foo seconddef
>> ... uses foo ... (seconddef is used)
>> endofblock
>> 
>> legal?
> 
> 
> For reasons we can ignore for now, it is legal in one place -- the top level 
> interactive environment.  Outside this context, it is not legal.  A name can 
> only be defined once in a scope.  Definition is not assignment.

Good.

Ralph Hartley