On Friday, 12 February 2016 at 19:12:48 UTC, Andrei Alexandrescu
wrote:
https://github.com/D-Programming-Language/phobos/pull/3991
A short while ago Dicebot discussed the notion of using the
allocator to store the reference count of objects (and
generally metadata). The allocator seems to be a good place
because in a way it's a source of "ground truth" - no matter
how data is qualified, it originated as untyped mutable bytes
from the allocator.
[...]
Destroy!
Andrei
So you can use metadata only with global allocators,
until you don't need to save ref to the allocator.
Why can't we use attribute @intransitive on ref fields to prevents
immutable being transitively applied on referred content?
Add some restrictions (only private, wrap using with trusted) and
it would be enough to implement RefCounting with immutable.