On Monday, 18 June 2012 at 14:37:26 UTC, Andrei Alexandrescu
wrote:
On 6/18/12 1:35 AM, Matthias Walter wrote:
On 06/18/2012 08:19 AM, Mehrdad wrote:
On Monday, 18 June 2012 at 06:14:22 UTC, Matthias Walter
wrote:
Its not, that a const method cannot modify an object, it just
ensures that the const method cannot modify the object *by
using
the this-pointer*.
I see...
So that means you /can't/ tell something just by looking at a
part
of the code, right?
(Just mentioning this since this idea seemed to be emphasized
a lot
by D.)
Yes, you are right with that.
Actually things are a fair amount subtler. On the face of it,
immutable does fulfill the OP's expectation. But even for const
code, there's still a lot of guarantees that can be inferred
depending on the types involved.
Andrei
Changing "new const(S)(0);" to "new immutable(S)(0);" still
doesn't work tho.