On Mon, 29 Nov 2010 14:52:54 -0500, Walter Bright <[email protected]> wrote:

Steven Schveighoffer wrote:
But in any case, const (even the non-logical variety) does not guarantee purity. Only pure functions do that (always return the same value for the same input)

Right, but C++ doesn't have purity either. I was trying to make the point that C++ does not have a "logical const" language feature. It's only a convention.

Yeah, but saying because a const function in C++ might return a different value because of logical const is, well, completely wrong :) Nobody is expecting const to guarantee purity. Even a D const function cannot make any assumptions about data that is const, because another alias could change it.

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.

-Steve

Reply via email to