try/catch idiom in std.datetime

growler growlercab at gmail.com
Thu Nov 21 18:55:08 PST 2013


On Friday, 22 November 2013 at 02:17:18 UTC, Andrei Alexandrescu 
wrote:
> On 11/21/13 6:07 PM, growler wrote:
>> 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
>>
>> It does if you return from the scope(failure) block. The 
>> problem is you
>> cannot mark the function as "nothrow"
>
> I was thinking that scope(failure) could throw an Error.
>
> Andrei

Yes, throwing an error makes more sensee than just return;




More information about the Digitalmars-d mailing list