Fully transitive const is not necessary

Steven Schveighoffer schveiguy at yahoo.com
Tue Apr 1 08:30:57 PDT 2008


"Janice Caron" wrote
> On 01/04/2008, Janice Caron wrote:
>> However, in the future, you will be able to declare
>>
>>     class X
>>     {
>>         private static int _x;
>>         invariant int x()
>>         {
>>
>>             return _x++; /*ERROR*/
>>        }
>>    }
>>
>>  and suddenly - bingo - the offending line will not compile.
>
> Well, not exactly. I made a fatal typo in that code, and consequently
> completely screwed it up! So much for forward planning! Let's try
> again. What I meant was:
>
>       class X
>       {
>           private static int _x;
>           pure int x()
>           {
>               return _x++; /*ERROR*/
>          }
>      }
>
> and suddenly - bingo - the offending line will not compile.

OK, now you're making a little more sense :)

This still does not require fully transitive const, and so there is no 
reason to force people who wish to develop with logical const to do so in 
the hack-ish manner that my example does...

-Steve 





More information about the Digitalmars-d mailing list