try/catch idiom in std.datetime

Shammah Chancellor anonymous at coward.com
Fri Nov 22 20:27:28 PST 2013


On 2013-11-22 02:51:11 +0000, growler said:

> Maybe that's why it is considered broken? The first point was to 'fix' 
> scope(failure) and then use it.
> 
> However, I don't know I haven't been following the discussion closely enough...

I think fixing it means disallowing return and assert(0) here.  Since 
these things generate unreachable code.  If it's fixed in the way I 
think it should be, it still wouldn't be useful here.

The proposed fix was to make it so scope(failure) assert(0);  Is 
detected as preventing the exception, so functions could be marked 
nothrow.   I don't think that's a good idea for the above reason.

I'd rather see Walter's proposed fix 
(http://forum.dlang.org/thread/l6ccae$2cmt$1@digitalmars.com?page=3#post-l6ds2b:241ii3:241:40digitalmars.com) 
of std.datetime, and my proposed fix for scope(failure).

-Shammah



More information about the Digitalmars-d mailing list