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.


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.


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:


decls code must X decls code

the compiler treats it internally as similar to:


decls code do

decls code X

on Error do

X Error:raise


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.