try/catch idiom in std.datetime

Daniel Murphy yebblies at nospamgmail.com
Mon Nov 18 02:16:20 PST 2013


"Jonathan M Davis" <jmdavisProg at gmx.com> wrote in message 
news:mailman.59.1384769025.2552.digitalmars-d at puremagic.com...
> On Monday, November 18, 2013 20:56:47 Daniel Murphy wrote:
>> "Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message
>> news:l6ccae$2cmt$1 at digitalmars.com...
>>
>> > 1. Fix scope(failure) and then use it.
>>
>> scope(failure) picks up Errors as well as Exceptions
>
> Ouch. That's true, which more or less kills that idea - though according 
> to
> Walter, it's not supposed to be guaranteed to do so, and he'd probably 
> prefer
> that it never did. But that's a whole debate in and of itself, and we've 
> had
> it before.
>
> - Jonathan M Davis

Yeah.  On the other hand, if we decide assert(0) means 'assume unreachable' 
we can optimize out the try-catch in release mode, among other things.

try { s } catch { assert(0); } -> s
if (e) assert(0); else s; -> e; s;

etc 




More information about the Digitalmars-d mailing list