Persistent list

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sun Nov 15 06:54:51 PST 2015


On 11/15/2015 09:34 AM, Dicebot wrote:
> On Sunday, 15 November 2015 at 14:23:05 UTC, Jonathan M Davis wrote:
>>> As I mentioned, he's okay with changing the language to make the
>>> casts well defined. -- Andrei
>>
>> Well, that's a big change, since it pretty much means that D's const
>> isn't physical const anymore, and Walter has been _very_ insistent
>> about that in the past - to the point that he's argued that C++'s
>> const is outright useless because it isn't physical const. If casting
>> away const and mutating is well-defined behavior, then we basically
>> have C++'s const except that it's transitive ...
>
> Casting away _const_ is already legal if programmer can himself
> guarantee underlying object has mutable origin (i.e. not available via
> immutable reference), by the very definition of const. It is casting
> away immutable and mutating that is strictly UB.

Correct. I'm not sure whether that's clarified in the language 
documentation yet. -- Andrei


More information about the Digitalmars-d mailing list