try/catch idiom in std.datetime
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Nov 18 10:15:29 PST 2013
On 11/18/13 9:00 AM, Daniel Murphy wrote:
>> void fun() nothrow
>> {
>> scope(failure) {}
>> throw new Exception("so sue me");
>> }
>>
>
> Yes, obviously a bug. The compiler is missing the rethrow.
https://d.puremagic.com/issues/show_bug.cgi?id=11542
> My point was only that try-catch(Exception) and scope(failure) do not have
> the same semantics.
Now I got it, thanks. Far as I can tell in this case it doesn't make a
big difference, is that correct?
a) with try/catch: Exceptions are transformed in AssertError, Errors
just go through
b) with scope(failure): everything is transformed in AssertError.
There is a difference, but both behaviors would be acceptable.
Andrei
More information about the Digitalmars-d
mailing list