3 ms·
> Without exceptions this is tougher as you need to unroll everything manually in order to retry. I don't get why you think this is a problem. You can triviall
by vidarh 13y ago
> Without exceptions this is tougher as you need to unroll everything manually in order to retry.
I don't get why you think this is a problem. You can trivially "unroll" it by explicitly writing your functions to be single-exit and "unrolling" at the end before returning whatever your result is.
"Exception handling" without "real" exceptions is then also trivial: just check the appropriate error code and take whatever action is suitable at the time.
- tracker1 13y agoThis is why I really like the callback pattern that node.js tends to use for all it's IO api calls... the callback always has the option for an error first.. generally if its' a nested callback, bubble up early. Internally, the C code can just check the state and call the callback method early if an error state arises.