try/catch idiom in std.datetime
Jesse Phillips
Jesse.K.Phillips+D at gmail.com
Thu Nov 21 18:13:42 PST 2013
On Friday, 22 November 2013 at 01:49:11 UTC, Shammah Chancellor
wrote:
> On 2013-11-18 06:32:46 +0000, Andrei Alexandrescu said:
>>
>> 1. Fix scope(failure) and then use it.
>>
>> Andrei
>
> Huh? Scope failure has no purpose here. It does not CATCH the
> exception and prevent it from bubbling up the call chain.
> Try/catch does do this.
>
> -Shammah
If the code is:
scope(failure) assert(0);
Then it is a statement that the function doesn't throw. So there
isn't a need to catch the exception, it is merely a way to state
to the compiler "I've verified I know what I'm talking about and
this function really doesn't ever throw."
Right now just having scope(failure) in the body is making this
statement, and that is wrong.
More information about the Digitalmars-d
mailing list