top | item 7758422

(no title)

aufreak3 | 11 years ago

> Are there any other languages that allow the calling scope to specify how lower-level functions handle errors without unwinding the stack?

While it isn't a mainstream language by any means, a scheme dialect called muSE [1] that I developed for writing logic for automatic music video construction supports such resumes and retries. [2]

[1] https://code.google.com/p/muvee-symbolic-expressions/

[2] https://code.google.com/p/muvee-symbolic-expressions/wiki/Ex...

(Apologies for shameless plug)

-- edit: I just saw that the clojure library "ribol" has an api design similar to muSE's in principle. A couple of design comments though -

1. The "on blah blah" is too much syntax for this. It prevents direct sharing of handlers between similar situations. Function argument pattern matching ought to be enough.

2. The retry options mechanism is somewhat limited - the options seem to apply only at the raise point itself (disclaimer: I've only had a quick glance at ribol). It is more useful to have multiple retry options at different scopes so you can partially unwind, try something, if that doesn't work unwind some more (perhaps involving cleanup), try something else, etc.

I think muSE's design is better on both these fronts.

discuss

order

No comments yet.