wires
wires copied to clipboard
Gracefully handling exceptions in arbitrary subnetworks
Say, we have a certain network subpart that can potentially throw pure exceptions, and we would like to handle them gracefully -- within the FRP framework itself (perhaps by transforming to Event
s?).
What approach is advocated by Wires
, in such situations?
That's actually a very good question, because the semantics (which currently doesn't exist as a formal document) would suggest that pure exceptions can only manifest as bottom values in events and behaviours, so they would basically cause the program to abort in animate
or onEvent
, unless you use an explicit exception handler there before you try to evaluate. However, you might also get that exception when using evalWith
, in which case there is no clean way to catch it within control
.
In practice any part of the application can throw an exception, for example if you use an undefined behaviour or event. There is no way to catch these exceptions cleanly within control
either.
I can't really judge the relevance of the following, but there is some prior art in Common Lisp -- a dynamic language, yes, which invalidates a large part of motivations -- and yet, I hope it might be somewhat useful:
- http://www.nhplace.com/kent/Papers/Condition-Handling-2001.html
- https://web.archive.org/web/20080916193133/http://dlweinreb.wordpress.com/2008/03/24/what-conditions-exceptions-are-really-about/
Edit: Kent Pitman and Dan Weinreb were heavily involved in standartization of Common Lisp -- Pitman was the editor of the final standard. Edit II: there's also a relevant LtU thread:
- http://lambda-the-ultimate.org/node/1544