Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And the potential need to pass way more than one, if you have 5 different error conditions which can exist in the same stack you need to come up with some sort of standard way to express that (e.g. a mapping of condition to callable). Then you need to find out how to express inheritances/overrides, and the like.


Nah, you only need one error callback with a parameter, i.e. `f(error)`. You could override this at any point using closures. We're talking almost identical code.


And you also define the recovery strategies within the function that cares about them. It makes the code much more readable.

You also continue the computation from that call-site without losing the stack. If after a particular restart is invoked, processing can continue along the chain without missing a beat.


No... we could already do that with higher-order functions. We're going backwards here, please read the previous comments, specifically from ajuc.

As stated, a higher order function gives you all of these features already. (The discriminator function I suggested would just return a bool to indicate whether or not error recovery should occuur, which is handled at the call site, in the appropriate context, with the appropriate stack).

All Condition Handling brings to the table is the ability to omit passing the callback around. All the other features were already there.

Edit: mschaef's comment confirms this.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: