6. Exceptions
Mainstream languages use exceptions to signal that an operation cannot complete
normally, and to transfer control from the point of failure to the code prepared to
handle it. Laurel models this directly: a procedure declares what it may throw with
throws, a throw statement raises a value, and try / catch / finally
handles it. Modelling exceptions here means each frontend does not have to
re-implement them.
Laurel imposes no root exception type, and does not require a thrown value to belong
to any particular hierarchy — a procedure may declare throws int and throw 3.
What Laurel provides instead is subtype-aware typing of the catch binding, so each
frontend uses its own hierarchy directly: Java's Throwable, Python's
BaseException, or JavaScript's convention of throwing an Error.