[E-Lang] List of core E features?

Mark S Miller markm@caplet.com
Mon, 01 Oct 2001 15:57:15 -0700

At 11:25 AM Monday 10/1/01, Marc Stiegler wrote:
>One thing not called out here anywhere explicitly is the when/catch/finally,
>which is core to what makes E distinctive. I do not know if it qualifies as
>a primitive by your definition, but it certainly qualifies in mine :-)

when-catch-finally is not part of Kernel-E.  Instead, it expands to a call 
to "Ref whenResolved/2" 
.  This method happens to be implemented primitively, but it could be 
implemented in E. This method sends the "whenMoreResolved/1" message.  
Kernel-E references do provide necessarily primitive support for two of the 
Miranda messages -- whenMoreResolved/1 and whenBroken/1.  For all messages, 
a broken reference will only return an equivalently broken result, and will 
forget the message. For these two messages, a broken reference will 
additionally send itself to the argument. For all other messages, a broken 
reference will ignore the argument.

CapTP remote references likewise handle these two messages specially, in 
order to preserve the guarantee of notification on 1) resolution, or 2) 
breakage.  Since a remote resolved reference (a far reference) may still 
break due to partition, a whenBroken/1 on a far reference must remember the 
argument (as a breakage reactor) so long as the far reference remains live.

Just as normal reactor (observer, listener) registration messages enable one 
to ask to be notified when an object changes state, these two messages 
enable one to ask to be notified when a reference changes state.  Since 
references are not normally reified (since they are the means by which their 
designated target is reified), some kind of special mechanism was 
necessarily.  I'm not at all convinced this was the right mechanism to 
introduce, but it works, and no one has yet suggested anything better.

In summary, we have a 3-layer cake:

3) when-catch-finally (defined by expansion to Kernel-E)
2) Ref whenResolved/2 (happens to be primitive, but not for any good reason)
1) whenMoreResolved/1 (necessary primitive support by references)

and a corresponding 2-layer cake:

2) Ref whenBroken/2 (happens to be primitive, but not for any good reason)
1) whenBroken/1 (necessarily primitive support by references)