Persistent list

Jakob Ovrum via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 14 19:23:20 PST 2015


On Saturday, 14 November 2015 at 16:05:10 UTC, Andrei 
Alexandrescu wrote:
> Technically, that clearly works. There's a problem with scaling 
> it up:
>
> COMPOSITION
>
> Disallowing immutable(RC!T) in favor of RC!(immutable T) 
> effectively disables composition of larger immutable objects 
> from smaller ones.

Yeah, I totally agree, I by no means think that external 
reference counting is some kind of silver bullet - as proven time 
and again, it is rife with issues when applied generally. I just 
wanted to point out, since a lot of lay people read these 
threads, that it will continue to be an option. I look forward to 
see what kind of memory safe reference counting you PL buffs will 
figure out.

> One obvious thing to do is with a reference counted object it 
> to make it a field of a larger object. That effectively makes 
> that larger object impossible to be used with immutable, 
> transitively.

Random off-topic thought (sorry): maybe the immutable larger 
object could survive if there was a way to make 
immutable(RefCounted!T) behave like immutable(Unique!T). It would 
be uncopyable (non-copyable? Damn you, boost!) but perhaps still 
usable. I guess it would still need a cast for 
`free`/`deallocate` in the destructor.




More information about the Digitalmars-d mailing list