We need a typesystem-sanctioned way to cast qualifiers away

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 21 22:25:31 PDT 2015


On 6/21/15 8:49 PM, Andrei Alexandrescu wrote:
> On 6/21/15 12:31 AM, Edmund Smith wrote:
>> This idea makes sense with the type checker, although I'm not sure how
>> it fits D's current memory model. On the page detailing const and
>> immutable (dlang.org/const3.html) it mentions that immutable data 'can
>> be placed in ROM (Read Only Memory) or in memory pages marked by the
>> hardware as read only', which may be problematic if an immutable's
>> mutable reference counter is placed in a read-only page. Would this
>> potentially be changed? It suggests that the compiler needs a way of
>> telling if the struct is a typical immutable struct or is
>> privately-mutable, publicly-immutable.
>
> Yah, that would need to be changed. That's why we need a way to tell the
> typesystem about that kind of data. It can't be put in read-protected
> memory of any kind.

Or, use a special value for the reference count that signals ROM.

-Steve



More information about the Digitalmars-d mailing list