Logical const
Walter Bright
newshound2 at digitalmars.com
Mon Nov 29 22:24:18 PST 2010
Simen kjaeraas wrote:
> Walter Bright <newshound2 at digitalmars.com> wrote:
>
>> Logical const means the same value is returned every time, not a
>> different one.
>
> So you would have only pure functions work with logical const?
No, I said that logical const is not verifiable by the compiler
> Going further, one could define mutable state only in (pure) member
> functions. This state would actually be stored in the object, but would
> be inaccessible to other member functions, and would not be considered
> by opEquals. I believe this is the closest we could come to enforcing
> logical constness.
It still is not verifiable. That's why logical constness is not a language
issue, it is a convention.
More information about the Digitalmars-d
mailing list