Logical const
Walter Bright
newshound2 at digitalmars.com
Mon Nov 29 15:04:31 PST 2010
Steven Schveighoffer wrote:
> On Mon, 29 Nov 2010 15:58:10 -0500, Walter Bright
> <newshound2 at digitalmars.com> wrote:
>
>> Steven Schveighoffer wrote:
>>> Having a logical const feature in D would not be a convention, it
>>> would be enforced, as much as const is enforced. I don't understand
>>> why issues with C++ const or C++'s mutable feature makes any
>>> correlations on how a D logical const system would fare. C++ const
>>> is not D const, not even close.
>>
>>
>> Because people coming from C++ ask "why not do it like C++'s?"
>
> I don't get it. A way to make a field mutable in a transitively-const
> system is syntactically similar to C++, but it's not the same. Having a
> logical-const feature in D does not devolve D's const into C++'s const.
> If anything it's just a political problem.
Having mutable members destroys any guarantees that const provides. That's not
political.
And, I repeat, having a mutable type qualifier DOES NOT make logical const a
language feature. This is why discussion and understanding of C++'s const system
is so important - people impute characteristics into it that it simply does not
have.
More information about the Digitalmars-d
mailing list