contracts in interfaces

bearophile bearophileHUGS at lycos.com
Thu Dec 13 14:37:10 PST 2012


Yann:

> could someone tell me what the problem(s) with the following 
> are?

>   //why does this not compile:
>   out(g) { assert(g.n == end - start); }
>
>   @property uint n();

n() needs to be const:
     @property uint n() const;



> why does this produce a segmentation fault when executed:

I don't know, you should show us a more complete minimal code 
that shows the segfault.


> Also, how do I make "$" work with the slice operator?

There is opDollar. But so much time has passed since dmd 2.060, 
that I don't remember if that works in dmd 2.060 or only in 2.061.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list