I'd say the default in C++ (as well as in Java) is to rethrow since any exception that haven't got a handler is rethrown.
The difference from the construct we've been discussing here is that in those languages the test to match the exception is done through the type only, so that catch clauses are never even entered before the error is considered to match.
In Pike we want to have a more flexible system where we can write arbitrary code to do those tests. Thus the onerror clause is always entered and there's no way of knowing implicitly where the code that does the testing stops and that which does the actual handling starts.
That's why it's necessary to consider errors as unhandled when they enter the onerror clause and to have some statement to explicitly tell that they are to be considered handled.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-10-02 19:25: Subject: Re: throw or return
On Thu, Oct 02, 2003 at 07:05:04PM +0200, Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
reaches the end of the onerror clause? I.e. the user should always specify either rethrow or continue before that?
I am not sure now... :) Initially I'd like explicit decision in any case, but now... After some thinking... Just not sure. I like the model in C++, where the default is "handled" (hence no rethrow), but all this just needs some thinking... A bit more...
Regards, /Al
/ Brevbäraren