Persistent list

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Nov 14 07:41:12 PST 2015


On 11/13/2015 06:26 PM, Ali Çehreli wrote:
> On 11/13/2015 03:10 PM, Andrei Alexandrescu wrote:
>
>  > at http://dpaste.dzfl.pl/0981640c2835
>
>  > * Lines 11-12: I came to terms with the notion that some types cannot be
>  > made immutable.
>
> Could constructor qualifiers help in such cases? I would like to hear
> war stories and experiences from others who used that feature before:
>
> The spec:
>
>    http://dlang.org/struct.html#struct-constructor
>
> My rewording:
>
>
> http://ddili.org/ders/d.en/special_functions.html#ix_special_functions.constructor%20qualifier
>
>
> DIP53:
>
>    http://wiki.dlang.org/DIP53
>
> Ali

Great writeup. Constructor qualifiers are part of the larger discussion 
about collections, but in this case it's a deeper matter.

The code uses non-atomic ++ and -- for the refcount exactly because an 
immutable List cannot be constructed, so it's not shared among threads.


Andrei



More information about the Digitalmars-d mailing list