Extended Type Design.
kris
foo at bar.com
Fri Mar 16 17:44:17 PDT 2007
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?
More information about the Digitalmars-d
mailing list