wires icon indicating copy to clipboard operation
wires copied to clipboard

Gracefully handling exceptions in arbitrary subnetworks

Open deepfire opened this issue 7 years ago • 2 comments

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 Events?).

What approach is advocated by Wires, in such situations?

deepfire avatar Mar 04 '17 07:03 deepfire

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.

esoeylemez avatar Mar 04 '17 21:03 esoeylemez

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

deepfire avatar Mar 05 '17 15:03 deepfire