contract programming without a function

Don Clugston dac at nospam.com.au
Sun May 20 09:26:56 PDT 2007


Ary Manzana wrote:
> It's gone from the documentation, but luckily I've got an old one (this 
> is from DMD 0.176). In the "Contracts" section it was said:
> 
> | The in-out statement can also be used inside a function, for example, 
> | it can be used to check the results of a loop:
> |
> | in
> | {
> |     assert(j == 0);
> | }
> | out
> | {
> |     assert(j == 10);
> | }
> | body
> | {
> |     for (i = 0; i < 10; i++)
> |     j++;
> | }
> |
> | This is not implemented at this time.
> 
> I guess this is exactly what you want in the example you gave. I don't 
> know why it's gone from the documentation, though. Maybe these feature 
> was dropped from future plans?

Because it wasn't implemented, either it had to be a compiler bug, or 
removed from the spec. Walter chose the latter. It might come back some 
day, though.
> 
> Regards,
> Ary


More information about the Digitalmars-d-learn mailing list