[E-Lang] when-catch-finally (was: pending revision of E in a Walnut)

Mark S. Miller markm@caplet.com
Thu, 23 Aug 2001 02:18:50 -0700


The control-flow variant of Alan's suggested change to when-catch is now 
implemented.  This involves three changes to the spec:

* An optional finally clause is now allowed.

* A chain of catch clauses is now allowed.  The first catch clause whose 
pattern matches the thrown exception is the one run, as with the try-catch.
(Alan caught this as well.  Thanks!)

* The catch clauses apply to both the possible eventual breakage of the 
expression in the "when (...) ->" head (as is traditional) and the throwing 
of any exceptions from there to the first catch clause (which is novel).


Now that this is control-flow oriented, there is a new counter-intuitive 
issue: An exception thrown during the evaluation of the expression in the 
"when (...) ->" head is *not* caught by these catch clauses, but is rather 
thrown in the original context.  I think it needs to be this way, but people 
will find it surprising.