Head Const

Marc Schütz via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 21 05:29:52 PST 2016


On Friday, 19 February 2016 at 00:45:00 UTC, Walter Bright wrote:
> On 2/18/2016 6:04 AM, Marc Schütz wrote:
>> Rule 2 only forbids _static immutables_ with @mutable members, 
>> precisely because
>> those could end up in read-only memory. I don't see how 
>> allocators are affected
>> at all. An allocator would be mutable, or at least manage 
>> mutable memory.
>
> You could create a bunch of immutable data structures, then 
> make the page they are in read-only.

You can do this with normal mutable data structures as well, 
which already shows that it's a problem on a different level. 
(And `mmap()` is @system.)


More information about the Digitalmars-d mailing list