Laurel Language Designer Guide

10.16. Exception inference🔗

Laurel enforces catch-or-declare, so a frontend must currently declare every exception a procedure may let escape. For the unchecked exceptions of Python and JavaScript — and for Java's — that means nearly every procedure ends up with a throws clause, and every call site pays to propagate and unwrap a result that almost never carries an exception.

The planned refinement is to infer a procedure's throwable types from its body: a bottom-up analysis over the call graph combining the types a procedure throws directly, the types its callees may throw, and the types it catches locally. A frontend would then declare only what it wants to pin as part of a signature, and let Laurel supply the rest.