\subsubsection{Assert} The last statement, of very low importance, is the \kw{assert} statement. In a real program the \kw{assert} statement is likely only to be used to enforce invariants, or otherwise only in tests, which are further discussed in \S\ref{sec:tests}. \begin{bnf*} \bnfprod{Assert}{ \bnfts{\kw{assert}} \bnfsp \bnfpn{Expression} \bnfor } \\ \bnfmore{ \bnfts{\kw{assert}} \bnfsp \bnfpn{Expression} \bnfsp \bnfts{\kw{as}} \bnfsp \bnfpn{Expression} } \end{bnf*} The \kw{assert} statement is optionally provided an expression (before \kw{as}) which is only evaluated in case of failure to be included in an error message. If no message is provided, the source text of the expression being asserted is extracted and used as the message. The other (or only) expression is the condition which is used to determine whether to end the program. If it evaluates to \kw{true}, the assertion was a success and execution continues. When \kw{false}, the message expression (if any) is evaluated, an effect is \kw{yield}ed of the form \texttt{'unhandled\_exception(message)}. While it is possible to handle this effect, it is not recommended for anything but exceptionally specific reasons, as assertion errors are typically a sign of programer failure. If the handler for this effect attempts to \kw{resume}, the program will end. \begin{prooftree} \AxiomC{$\Gamma\vdash C = \kw{true}$} \LeftLabel{Assertion} \UnaryInfC{$\Gamma\vdash \kw{assert}\ M\ \kw{as}\ C : \top$} \end{prooftree} \begin{prooftree} \AxiomC{$\Gamma\vdash C = \kw{false}$} \LeftLabel{Assertion} \UnaryInfC{$\Gamma\vdash \kw{assert}\ M\ \kw{as}\ C : \bot$} \end{prooftree}