On Sunday, 1 March 2015 at 16:45:04 UTC, Zach the Mystic wrote:
On Sunday, 1 March 2015 at 01:40:40 UTC, Andrei Alexandrescu
wrote:
One possible solution is to add a "@mutable" or "@metadata"
attribute similar to C++'s keyword "mutable". Walter and I
both dislike that solution because it's hamfisted and leaves
too much opportunity for abuse - people can essentially create
unbounded amounts of mutable payload for an object claimed to
be immutable. That makes it impossible (or unsafe) to optimize
code based on algebraic assumptions.
I need to get educated on this issue. First suggestion: Just
break the type system by encouraging the idiom of using casts
in opAddRef and opRelease. It's too easy, but I don't know why.
Well I guess it's about optimizing code. So the question is what
the optimizer needs to know, and why.