ERights Home elang / kernel 
Back to: Catch Expression On to: Immediate Call Expression

Finally Expression


Has the conventional meaning, generalized to an expression language -- evaluate the first expression (the attempt), but, no matter how it exits, evaluate the second expression (the unwinder) before exiting the finally expression.

BNF:
"try" "{"
    eExpr
"}" "finally" "{"
    eExpr
"}"
XML DTD:
<!ELEMENT finallyExpr (%eExpr;, %eExpr;)>
Java:
try {
    jExpr
} finally {
    jExpr
}
Example:
see catchExpr
in Kernel-E:
 
in XML:
 
in Java:
 

If the unwinder exits normally, then the outcome of the finally expression is the outcome of the attempt, no matter whether this outcome is a normal evaluation to a value or a non-local exit. The value of the unwinder is unused. If the unwinder performs a non-local exit, whether an ejection or a throw, then the outcome of the finally expression is the unwinder's outcome. We say the unwinder's outcome substitutes for the attempt's outcome.

Note that sudden vat destruction is not, whether intended or not, considered a form of exit of computation in the vat. Therefore, if the attempt suddenly destroys its hosting vat, unwinders are not run before the destruction occurs.

The attempt and unwinder are each in their own scope box.

 
Unless stated otherwise, all text on this page which is either unattributed or by Mark S. Miller is hereby placed in the public domain.
ERights Home elang / kernel 
Back to: Catch Expression On to: Immediate Call Expression
Download    FAQ    API    Mail Archive    Donate

report bug (including invalid html)

Golden Key Campaign Blue Ribbon Campaign