💾 Archived View for vierkantor.com › xukut › manual › swail › condition.gmi captured on 2024-05-26 at 14:50:05. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-05-10)
-=-=-=-=-=-=-
Swail indicates situations that require exceptional control flow through *raising a condition*. In particular, Swail's builtin errors use the condition system.
When a condition is raised, control passes to the (dynamically determined) currently installed handler. The handler inspects the condition, and can decide between a variety of actions, including to stop the current process, to return a value to the condition caller, or to restart execution at another place in the context.
You can install *restarts* to return control to another place when a condition occurs. For example, you can go back to the start of a long computation if there's an error in one subcomputation. The term *default restart* means the consequences of returning a value from the handler, rather than the handler invoking a restart. At the moment, there isn't really a finished restart interface, stay tuned for more details as they emerge.
The currently installed condition handler. The value bound to `handler' is called on each condition that is raised.
The default handler kills the current process and pops up an error message with debug information.
Raise a condition with information `context'.
The current handler is called on `context'. If the handler returns a value, this will be the result of the call to `condition' (this is considered invoking the default restart). A call to `condition' is quite likely not to return, for example when the handler decides to invoke a restart or to stop the current process entirely.
Raise an error with information `context'.
This is currently a synonym of `condition', which conveys the additional information that the condition is caused by a programming mistake, rather than a recoverable, anticipated situation.
Any questions? Contact me:
By email at vierkantor@vierkantor.com