Persistent list
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Sun Nov 15 11:49:23 PST 2015
On 11/15/2015 01:57 PM, Andrei Alexandrescu wrote:
> 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
Given your recent efforts to change the meaning of const, I think it is
no longer as clear-cut as it was when I reported the bug. Those
delegates can only mutate const objects that were constructed as mutable.
More information about the Digitalmars-d
mailing list