syntax question on "invariant" keyword

Bill Baxter dnewsgroup at billbaxter.com
Tue Jul 3 18:53:51 PDT 2007


Daniel919 wrote:
>> struct S
>> {
>>     int x = 9;
>>     invariant int y = 8;
> 
> Instead of it, this is working:
> 
> const int y = 8;
> static invariant int y = 8;
> 
> final int y = 8; //but this takes up storage for each instance
> 
>>     void foo()
>>     {
>>         // y  = 7; // Expectedly, this fails to compile (GOOD).
>>     }
>> }
> 
> I already wrote a bug report: #1312


Looks like we should have stuck with "super const" after all.  :-P

--bb


More information about the Digitalmars-d-learn mailing list