Head Const
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Tue Feb 16 18:51:06 PST 2016
On 2/16/2016 11:29 AM, Marc Schütz wrote:
> For example, it's always possible to use a global mutable associative array to
> store additional data connected with an immutable or const object (ignoring
> purity issues for the moment). That's safe because from the outside, there's no
> observable change to the state of the object itself, and the global AA's type
> (shared/thread-local) prevents race conditions.
The trouble with that is you're relying on the programmer to ensure correctness.
It'll revert D to C++ "trust the programmer" semantics.
Furthermore, with the current mechanical guarantee of immutability, it opens up
the possibility of relying on such beyond merely observable behavior - such as
immutable data being placed in ROM, or special GC semantics.
More information about the Digitalmars-d
mailing list