On 7/10/12 7:57 PM, Walter Bright wrote:
On 7/10/2012 4:16 PM, Timon Gehr wrote:
Const is stronger than what is required to bridge the gap between
mutable and immutable. It guarantees that a reference cannot be used to
mutate the receiver regardless of whether or not the receiver is
immutable underneath. That is unnecessary as far as immutable is
concerned. It only needs to guarantee that the receiver does not change
if it is immutable underneath.

If you have a const function that accepts both mutable and immutable
args, then that function *by definition* cannot tell if it received
mutable or immutable args.

It can if immutable(T) is invalid.

Furthermore, a const function is saying it will not change, even if
mutable data is passed to it.

Lazy computation does not produce detectable change.

Everything falls apart once you allow "logical const" in. You'll be in
the same boat as C++ const, which is faith-based programming rather than
checkable programming.

Then please do not suggest pimpl and casting. That is UNDEFINED. If you want to ascribe any meaning to it, you ruin all the work we've done on immutability.


Andrei

Reply via email to