Persistent list

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


On 11/14/2015 04:45 PM, Andrei Alexandrescu wrote:
> On 11/13/2015 06:41 PM, Timon Gehr wrote:
>> On 11/14/2015 12:10 AM, Andrei Alexandrescu wrote:
>>>
>>> * Lines 6: By construction the list doesn't work with mutable objects.
>>
>> =(
>
> I've decided persistent lists with mutable elements just too weird to
> endorse.

Not /enforcing/ _transitive_ immutability is not the same as endorsing 
arbitrary mutation patterns as reasonable.

> Lisp allows them but every time it mentions that it very
> strongly advises against it.
> ...

This is just not true. E.g. lazy thunks are considered fine.

> Other container semantics are better, I think, for mutable elements.

Right, because e.g. whether the elements are reference counted or traced 
should totally completely change the required container semantics for 
the problem at hand! This does not make any sense, unless you are saying 
that nobody should actually use the persistent containers, in which case 
it seems like a waste of time to concentrate efforts on them.

You have not provided a technical argument, so I am going to assume you 
have an irrational fear of bad PR. Forcing transitive immutable on 
people who want persistent container semantics is ultimately a very poor 
choice both from a technical and a PR perspective.

> Let's leave persistent lists have their nice value semantics.
> ...

It does not make sense to conflate transitive immutability and value 
semantics, unless one considers it reasonable to make all struct fields 
transitively tail-immutable.


More information about the Digitalmars-d mailing list