Persistent list

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 15 04:57:49 PST 2015


On 11/14/2015 06:48 PM, Timon Gehr wrote:
> On 11/15/2015 12:20 AM, Andrei Alexandrescu wrote:
>> On 11/14/15 5:49 PM, Timon Gehr wrote:
>>> It's supposed to guarantee that the given reference is not used to
>>> transitively mutate the object. The casts violate this.
>>
>> I think that semantics needs to change. Specifically, either we add a
>> @mutable attribute (which means const doesn't apply to fields marked as
>> such and immutable objects cannot be created); or we could just decree
>> that if a const object originates in a mutable object, casts should be
>> well-defined. -- Andrei
>>
>
> There's also this closely related situation:
> https://issues.dlang.org/show_bug.cgi?id=9149
>
> (I.e. delegates with mutable context pointer can be implicitly converted
> to delegates with const context pointer, but when type checking the
> delegate, a mutable context pointer is assumed.)

That's a hole straight into the middle of things. We need to fix that. 
-- Andrei


More information about the Digitalmars-d mailing list