Exceptions
CellSpeak has exception handling. Exceptions are used for events that happen inside a cell but are best processed outside the normal control flow, either because they are cumbersome to check for every time or because they simply cannot be handled in a meaningful way at the level where they occur.
Every code unit in CellSpeak - ie a function, a message handler, a constructor, a destructor or a design itself can have one exception table. The exception table lists the exceptions that you want to handle in the code unit.
Exceptions are always handled in the context of the cell where they occur. Exceptions are a flow control mechanism - with stack unwinding and handler selection - that only make sense during the execution of code for a cell. A cell can of course always signal an exception to another cell by sending a message from the handler for example.
Exceptions can be generated by the OS (such as IntDivideByZero or AccessViolation) or in the CellSpeak code by using the 'raise' statement. Exceptions can have parameters.
Exceptions that are not handled are propagated to the next level - up to the level of the cell. If the exception is not handled at that level, then the cell can be destroyed depending on the graveness of the exception.