DIP 1018--The Copy Constructor--Final Review
Nick Treleaven
nick at geany.org
Mon Mar 4 11:20:22 UTC 2019
On Sunday, 3 March 2019 at 21:33:07 UTC, Paolo Invernizzi wrote:
> On Sunday, 3 March 2019 at 13:06:31 UTC, Nick Treleaven wrote:
>> Andrei has updated the DIP explaining why this wouldn't be a
>> good @safe solution - see the `class Window` example:
>>
>> https://github.com/dlang/DIPs/blob/5a10e274f7befcd2e615cdcbee549791cf11318e/DIPs/accepted/DIP1018.md#breaking-changes-and-deprecations
>
> __mutable
You mean annotate all reference type fields with __mutable? I
really don't think that is what it is being designed for.
Razvan's proposal [1] has many restrictions on __mutable:
* "__mutable can only be applied to private members"
* "Global/Local and static variables cannot be __mutable"
* "__mutable data can only be manipulated in @system code"
* "__mutable fields of const instances also need to be regarded
as shared" [*]
These restrictions mean mass __mutable use on reference type
fields would be unsafe and very prone to introducing races in MT
code.
[1]
https://github.com/RazvanN7/DIPs/blob/Mutable_Dip/DIPs/DIP1xxx-rn.md
[*] Note: I submitted a PR to fix some typos in this section
More information about the Digitalmars-d
mailing list