https://issues.dlang.org/show_bug.cgi?id=14251

--- Comment #15 from Andrei Alexandrescu <[email protected]> ---
(In reply to Lodovico Giaretta from comment #14)
> (In reply to Andrei Alexandrescu from comment #13)
> > Can someone produce an example in which invariants promised by D's system
> > are broken?
> 
> immutable provides a strong guarantee, that allows me to put my immutable
> data in ROM. If I manage to have an immutable object allocated in ROM and
> someone tries to synchronize on it, my program will (in the best case) crash
> with a segmentation fault, as the synchronized statement tries to modify a
> mutex that is located in ROM.

That's not the case. The compiler knows the object has mutable metadata and
won't allow placing it in read-only pages.

--

Reply via email to