I've heard this approach described as a failure continuation, and it's a good approach. It's much easier to do in a language that allows for easy creation of closures. Such a system wouldn't be impossible to construct in C++; you could create an ErrorHandlers object that is passed as the last argument of every method and contains instances of some kind of "RestartCase" object. But I cringe at the amount of boilerplate that would be required to support such an approach.
Actually I've seen recoverable exceptions in C++, at my previous employer (ARM's Belgium office) using all sorts of creepy long jumps. It was ancient, arcane code, but it still worked - and was cross-platform.
2 comments
[ 5.5 ms ] story [ 11.6 ms ] thread