This should be immediately familiar at least to C++ and Java programmers. Let's call the "try" keyword and the scope-box which follows a "try clause". Similarly, we'll refer to a "catch clause" and a "finally clause". A try-expression must begin with one try-clause, may then have zero or more catch clauses, and optionally end with a finally clause. The try-expression first evaluates the attempt-expression. If this completes normally, then the value of the try-expression is the value of the attempt-expression. However, before the try-expression completes, the exit-expression, if any, is evaluated. Besides completing normally, there are three abnormal ways an expression might terminate:
In all cases, the exit-expression, if any, is evaluated as the last action before leaving the try-expression. If the exit-expression itself terminates abnormally, then its termination takes priority over whatever form of termination we were engaged in. |
||||||||||||
Unless stated otherwise, all text on this page which is either unattributed or by Mark S. Miller is hereby placed in the public domain.
|