Persistent list

Rikki Cattermole via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 13 19:12:12 PST 2015


Hmm. We can't have immutability and ref counting.
Lets just say, the only time ref counting should come into effect is IF 
it has been removed from the list. This way the list should consider it 
'owned' by it.

This is where I say, immutability by itself isn't the problem. The 
problem is we are unable to attribute new behavior to another type 
without effecting the type system directly.

If we can add new behavior without effecting the payloads immutability, 
we can add e.g. ref counting as needed.

This is where my 'managed memory'[0] idea is coming into play.
In essence, managed memory would allow a mutable addition to any given 
heap allocated type (not including pointers).

So sure the payload is attributed as being immutable, but ref counting 
can still go on safely!

Of course this is a major addition and is no where near ready for DIP 
status, but hey, maybe a solution?

[0] http://wiki.dlang.org/User:Alphaglosined/ManagedMemory


More information about the Digitalmars-d mailing list