invariant()

Jarrett Billingsley jarrett.billingsley at gmail.com
Sun Apr 12 07:29:52 PDT 2009


On Sun, Apr 12, 2009 at 8:57 AM, Michel Fortin
<michel.fortin at michelf.com> wrote:
> In D1 you had to write:
>
>        invariant
>        {
>                ...
>        }
>
> while in D2, to disabiguate with invariant being overloaded with
> immutability you had to write:
>
>        invariant()
>        {
>                ...
>        }

Actually, the D1 compiler now accepts the "invariant() {}" syntax, so
if you want your code to work with both D1 and D2, use that.

Whether it'll be going away, I'm not sure.  I guess Walter is the only
one who knows that.



More information about the Digitalmars-d mailing list