On Wednesday, 17 February 2016 at 02:51:06 UTC, Walter Bright wrote:
The trouble with that is you're relying on the programmer to ensure correctness. It'll revert D to C++ "trust the programmer" semantics.

You might end up in a worse position than C++, as people will cast away constness / immutability in third party libraries to get around the limitations.

C++ added "mutable" keyword for a reason... with head const which is much less limiting to begin with...


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.

A nonissue.

1. The compiler has access to all reachable types. It can easily determine if there are reachable types with @mutable fields.

2. This is not a good argument for transitivity of immutability as head-immutability is sufficient.

Reply via email to