[Issue 19620] Not quite sure what immutability means

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jan 26 19:42:58 UTC 2019


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

Neia Neutuladh <dhasenan at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dhasenan at gmail.com

--- Comment #1 from Neia Neutuladh <dhasenan at gmail.com> ---
"immutable applies to data that cannot change. Immutable data values, once
constructed, remain the same for the duration of the program's execution."

It seems extremely clear to me that "cannot change" is not the same as "could
never and did never change".

"Creating Immutable Data
...
The second way is to cast data to immutable. When doing so, it is up to the
programmer to ensure that no other mutable references to the same data exist."

Since "construct" and "create" are synonyms, it seems rather clear that the
spec does not intend to forbid casting previously mutated values to immutable.

If you want to make the spec more explicit, please submit a pull request.

--


More information about the Digitalmars-d-bugs mailing list