Getting the const-correctness of Object sorted once and for all

Christophe travert at phare.normalesup.org
Wed May 16 04:50:37 PDT 2012


Timon Gehr , dans le message (digitalmars.D:167544), a écrit :
> Leaving the rule out would imply that the currently valid code 
> transformation:
> 
> int foo(const pure A){ }
> 
> A a = ...;
> 
> int x=foo(a), y=foo(a)
> =>
> int x=foo(a), y=x;
> 
> would become incorrect in the general case. The proposal trades off 
> 'const' guarantees against mutable/immutable interoperability. I would 
> be willing to take that.

The language could declare that the transformation is legal, and that 
the programmer using 'mutable' members is responsible for keeping the 
function logically const.

-- 
Christophe


More information about the Digitalmars-d mailing list