Another idiom I wish were gone from phobos/druntime

Jonathan Marler via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 4 16:40:52 PST 2015


On Thursday, 5 February 2015 at 00:35:50 UTC, bearophile wrote:
> Contracts can be read by tools, and they are part of the 
> function signature. Contracts should be encouraged and 
> increased, not discouraged.
>
> Bye,
> bearophile

Not to mention that contracts can be removed by the compiler at 
compile time. i.e.

x.opSlice(i, i+1);

The assert can be compiled away since i+1 is always >= i. That's 
one of the great benefits of contracts.


More information about the Digitalmars-d mailing list