assume, assert, enforce, @safe
Daniel Murphy via Digitalmars-d
digitalmars-d at puremagic.com
Sat Aug 2 00:01:34 PDT 2014
"Jonathan M Davis" wrote in message
news:zbkvnbibbmcfwhjvmhau at forum.dlang.org...
> > IMO the correct solution is for the compiler to insert preconditions at
> > the calling site, rather than the callee.
>
> If we had that, I'd actually start using in blocks. As it is, I think that
> they're useless except when inheritance is involved, and they're more
> verbose than just putting the assertions at the top of the function, so I
> don't bother with the in block.
What do you think about
https://github.com/D-Programming-Language/dmd/pull/3799 ?
Basically, turn obviously invalid failing function calls into compile-time
errors. IMO this pushes in-contracts well out of the useless area.
More information about the Digitalmars-d
mailing list