Stick a fork in it

Chris Nicholson-Sauls ibisbasenji at gmail.com
Thu May 10 21:08:18 PDT 2007


Sean Kelly wrote:
> Bill Baxter wrote:
>> renoX wrote:
>>> Walter Bright a écrit :
>>>> Chris Nicholson-Sauls wrote:
>>>>> Actually, that'll be 'final'.  The new 'invariant' will mean "this 
>>>>> *data* absolute does not change", and the new 'const' will mean 
>>>>> "this is an *immutable view* into data owned by other code, which 
>>>>> *may* change".  (If I'm remembering/understanding right.)
>>>>
>>>> You're right.
>>>
>>> If the keywords are really like this, it's a bit weird, IMHO the most 
>>> interesting one is 'invariant' which happens to be also the one with 
>>> the longest name..
>>
>> But invariant is also the one most likely to appear on a line all by 
>> itself with just a single variable and a simple initializer.  And most 
>> uses will be close to the left margin I suspect.  And even if 
>> invariant is the most interesting, I think const will still be the 
>> most used.
> 
> I still can't keep all these straight in my head--the words are all 
> synonyms.  Hopefully that will change after I've used them a bit.
> 
> 
> Sean

I think I've just about gotten my head around it, but also feel it will come moreso with 
use.  I think of the word invariant as a "stronger" word than const(ant) -- the latter 
being a more common term, and the former more... formal -- so that's how I deal with it; 
ie, that 'invariant' is a "stronger contract" than 'const' is.  At least my time with Java 
semi-prepared me for 'final'.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d-announce mailing list