[E-Lang] Syntax change: reducing side-effects

Mark S. Miller markm@caplet.com
Mon, 12 Feb 2001 23:05:52 -0800

At 10:04 PM Monday 2/12/01, Dean Tribble wrote:
>One minor nit left; does the following mean anything?
>var [foo, bar] = [3, 4]

Not to me nor the Evar parser.  The parser cheerfully rejects this.

>The alternatives are:
>def var [foo, bar] = [3, 4]
>which I presume the parser sneers at; or:

It merely rejects it without deigning to sneer.

>def [var foo, var bar] = [3, 4]
>which I presume the rest of us sneer at; i.e., I prefer the compiler rejection

Me too.  Unfortunately, at the moment we only have parser rejection ;)

Steve Jenson of openCOLA and I have just spent the day programming in Evar, 
the E that incorporates Dean's "var" proposal.  It felt really good.  I 
hereby declare "var" to be part of E, and Evar to therefore now be E.

Btw, I mentioned earlier that Dean, MarcS, and I argued about this 
occasionally for weeks.  This way of putting it didn't give Dean enough 
credit.  During those weeks, Dean kept stressing the urgency of this issue, 
and I kept underestimating it.  Now that it's in the language, I realize 
it's more wonderful in more ways than I could have guessed, as I'll 
explain in upcoming email.  Thanks Dean!!

The ways so far:

* PassByCopy and Confined objects are easier to write such that they will 
pass the corresponding auditors, and are *much* easier to read.  I suspect 
this is true as well for other auditors yet to be invented.

* Previously, in order to get the expansion of cyclic definitions right, I 
had to introduce an ugly variant of Promise -- the SlotPromise.  With this 
change, I can get rid of SlotPromise, instead impose the restriction that 
"var" variables may not be used before they are defined, and resolve the 
remaining cycles using only the normal clean Promises.

* Only with this change have I been able to think clearly in terms of two 
different Kernel-E semantics, and the conversions between them.  The 
currently documented Kernel-E corresponds to "Slot Normal Form" (SNF), in 
which all variable are declared "var", and which primitively contains the 
concepts of ValueGuards, SlotGuards, Slots, and assignment.  OTOH, the 
Evaluator needs a Kernel-E in "Value Normal Form" (VNF), in which no 
variables are declared "var", and in which only ValueGuards remain from the 
above list as a primitive concept. When all variables are final, you no 
longer need Slots to explain them -- you can speak of the variables being 
directly bound to their values.

Except for the top level scope issues, it's clear how to convert between 
these two -- much as the Orbit compiler had an intermediate stage that 
reified locations.  But we still need to figure out how all this interacts 
with the top level scope.