try/catch idiom in std.datetime
Jonathan M Davis
jmdavisProg at gmx.com
Mon Nov 18 01:33:03 PST 2013
On Monday, November 18, 2013 10:24:11 Jacob Carlborg wrote:
> On 2013-11-18 10:18, Jonathan M Davis wrote:
> > I don't see much gain over simply putting scope(failure) at the top. You
> > just avoid having to write the assertion yourself
>
> You suggested it, but by adding it to the language instead.
True, but if the language did it, it could deal with it in a manner which
compiled out the try-catch in -release mode as well as avoid the ugliness of
wrapping the whole function body in a function call. Still, it would probably
be better if we could get the compiler to recognize the idiom and compile out
the try-catch in that case rather than adding something like that to the
language. But I don't know how reasonable that is.
- Jonathan m Davis
More information about the Digitalmars-d
mailing list