Marc Schütz via Digitalmars-d
digitalmars-d at puremagic.com
Tue Nov 17 01:54:36 PST 2015
On Monday, 16 November 2015 at 17:12:06 UTC, Steven Schveighoffer
> One thing, however, is that if you can mark an island of space
> within an object as ALWAYS mutable, the compiler can know this
> and avoid optimizing away access to those pieces. It would have
> to be clearly marked as such, so the optimizations on
> non-marked data could still happen.
Yes, that's a necessity, simply to stop the compiler from
applying breaking optimizations. However, then we would lose the
guarantees immutable provides, in particular implicit sharing,
and the implications for purity. That's why this mutability needs
to be restricted, so that it has no observable effects.
> I think it could be done, because logical const is possible via
> a global lookup table. Any time you go through a cast, however,
> this could easily break down.
That's a really good argument: We don't actually introduce new
semantics, we only want make existing techniques more accessible
More information about the Digitalmars-d