Persistent list

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 14 12:40:12 PST 2015


On 11/14/2015 05:05 PM, Andrei Alexandrescu wrote:
>
> Technically, that clearly works. There's a problem with scaling it up:
>
> COMPOSITION
> ...

Composition matters.

> Disallowing immutable(RC!T) in favor of RC!(immutable T) effectively
> disables composition of larger immutable objects from smaller ones.
>
> 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.
>
> That's not a bad thing; it's merely a factual acknowledgment that in the
> D programming language, immutable models (transitively and in a way that
> makes composition possible) true immutability of bits, which makes
> sharing possible at no cost. Reference counting is mutating, therefore
> it does not and cannot work with immutability as defined by D.

Obviously. But RC /does/ work with persistent containers! (Unless the 
author of the container has added a gratuitous compile-time check to 
make it impossible.)


More information about the Digitalmars-d mailing list