Extended Type Design.

Chris Nicholson-Sauls ibisbasenji at gmail.com
Mon Mar 19 11:11:06 PDT 2007


Bruno Medeiros wrote:
> 
> For what I got 'invariant' means the data doesn't change at all, like 
> compile time constants, or ROM data. But I didn't understand if it 
> applies to the "immediate-value" only (like 'final'), or transitively to 
> the referenced data too (like 'const'). Clarify?
> 

Its my understanding that 'invariant' becomes part of the type, like 'const'.  So in your 
terms, it applies to "referenced data".

invariant ANSWER = 42 ;

bool question (invariant int guess) {
   return guess is ANSWER;
}

;)

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list