In SML(sorry...), in: <exp1> handle <exp2>
<exp1> is evaluated and any exception raised within it is handled by an
appropriate handler in <exp2>. If there isn't one then the exception
is handled in the enclosing environment for the whole construct. Similarly,
if an exception is raised in <exp2> then it is handled in the enclosing
environment. So exception handling follows a stack based regime.
Instead, how about having <exp2> handle exceptions raised within itself
and also allowing mutually recursive handlers? This might form a very
nice inter-process communication mechanism, which may be recognised
by people who have written interrupt driven multi-process systems. It
probably has horrendous semantic implications...
Greg Michaelson