try/catch idiom in std.datetime
Shammah Chancellor
anonymous at coward.com
Fri Nov 22 13:49:08 PST 2013
On 2013-11-22 02:13:42 +0000, Jesse Phillips said:
> 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.
Scope failure blocks should not be able to raise errors, or return
except "out the end".
More information about the Digitalmars-d
mailing list