Extended Type Design.
Andrei Alexandrescu (See Website For Email)
SeeWebsiteForEmail at erdani.org
Fri Mar 16 18:01:15 PDT 2007
kris wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> Bill Baxter wrote:
>>
>>> Andrei Alexandrescu (See Website For Email) wrote:
>>>
>>>> Benji Smith wrote:
>>>
>>>
>>>>> I reiterate: "const" and "readonly" are the way to go. (Methods
>>>>> which promise not to modify the values of their parameters should
>>>>> use "readonly" rather than "const" in their method signatures.)
>>>>
>>>>
>>>> This makes const gratuitously incompatible to C++'s const, and
>>>> (worse) also adds a keyword that's its equivalent. I don't think
>>>> this can fly.
>>>
>>>
>>> What about 'immutable' for 'really can't change'/'superconst', and
>>> const can stay as is?
>>
>>
>> I like it, and suggested it at a point. Walter said that it's bad
>> marketing to define keywords in terms of a negative.
>
> So, "invariant" is already a keyword ... what about that?
>
> "Invariant" is currently used to stipulate a condition that must remain
> constant (or true) for the extent of the enclosing/relevant scope. Right
> now, it is used within a class only, but the semantics could presumably
> extend elsewhere too:
>
> invariant int * p = &x;
>
> void myFunc (invariant char[] arg) {}
>
> in both these cases, the "invariance" should remain for the extent of
> the relevant scope?
I completely missed that one. I think it's a good idea to look into it
as a candidate for a qualifier name. Thank you.
Andrei
More information about the Digitalmars-d
mailing list