We need a typesystem-sanctioned way to cast qualifiers away

Tofu Ninja via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 21 22:01:42 PDT 2015


On Monday, 22 June 2015 at 04:12:29 UTC, Andrei Alexandrescu 
wrote:
> On 6/21/15 8:43 PM, Tofu Ninja wrote:
>> On Monday, 22 June 2015 at 02:54:27 UTC, Andrei Alexandrescu 
>> wrote:
>>> All good points. I think we need to accept that immutable 
>>> objects must
>>> rely on the garbage collector; reference counting them is not 
>>> accepted
>>> in D's type system. -- Andrei
>>
>> I am confused, what is wrong with having a mutable ref counted 
>> wrapper
>> type that can carry an immutable payload?
>
> It doesn't compose - e.g. soon as you want to make an immutable 
> list of lists it comes unglued. -- Andrei

Hmmm.... I see, I guess I understand better why this is a 
problem. Is there no way to do immutable container with mutable 
payload? Is there no way to stop the transitive nature of 
immutable/const? This seems like it would be a problem for any 
sort of container type, what sort of problems would happen if 
there was a way to stop transitive qualifiers from being applied 
to members?


More information about the Digitalmars-d mailing list