any news on const/invariant?

Bill Baxter dnewsgroup at billbaxter.com
Mon Dec 17 01:09:59 PST 2007


James Dennett wrote:
> Walter Bright wrote:
>> Many C++ people have argued
>> passionately for logical const, but I have become strongly convinced
>> that the notion is fatally flawed.
> 
> How about a constant/immutable object that refers to and
> uses (but does not contain) a mutable object?  That's rather
> a common need, and it would be a shame not to be able to
> declare some object as being unchanging simply because it
> changes other objects' states, or to have to pass references
> to those other objects in to functions instead of holding
> them in member variables?

But the compiler needs to assume that every reference could be an owned 
reference since it doesn't know who you consider to be the "owner".

--bb



More information about the Digitalmars-d mailing list