syntax question on "invariant" keyword
BCS
ao at pathlink.com
Tue Jul 3 15:56:18 PDT 2007
Reply to Michael,
> BCS Wrote:
>
>> This is getting into the ambiguity between an invariant function
>> (that is part of design by contract)
>>
> Thanks, I didn't know that "invariant" can also be used for functions;
>
>> and an invariant value (that is one form of const).
>>
>> I think the way that it should be done is
>>
>> invariant(int) y;
>>
> I tried that, but:
> Test.d(6): found 'int' when expecting ')'
> Test.d(6): statement expected to be { }, not )
> Test.d(6): found ')' instead of statement
> Also,
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmar
> s.D.learn&article_id=8217 claims that "invariant int" and
> "invariant(int)" are NOT the same, but "invariant int" and "final
> invariant(int)" are the same.
>
> I don't know if that is true.
>
Are you using dmd 2.x or 1.x?
More information about the Digitalmars-d-learn
mailing list