MustΒΆ

A must-declaration can be used to ensure that particular code is guaranteed to run before a block is finished, even if an error occurs or ret, exit, while, until or next is used to exit the block early.

Note

Since susp-expressions can resume the current block, they do not run must code. In general, do not use must-declarations with susp-expressions unless it known that the generating function will always be completed.

Note

In order to guarantee a valid state when each must-expression is executed, each must-declaration implicitly creates a new block around the code that follows it. Given code like:

1decls
2code
3must X
4decls
5code

the compiler treats it internally as similar to:

 1decls
 2code
 3do
 4   decls
 5   code
 6   X
 7on Error do
 8   X
 9   Error:raise
10end

This means that some forward declarations that work without must may not work when must is present. This limitation might be removed in the future.