Rebooting the __metada/__mutable discussion
Paul Backus
snarwin at gmail.com
Fri Apr 8 02:32:29 UTC 2022
On Friday, 8 April 2022 at 01:46:35 UTC, Zach Tollen wrote:
> On Friday, 8 April 2022 at 01:24:38 UTC, Paul Backus wrote:
>> This is not entirely true. DIP 1035 also specifies that
>> variables whose initial values would not be allowed in `@safe`
>> code are inferred as `@system`, and this applies equally to
>> mutable and `immutable` variables.
>
> So it's dangerous enough to be pointing to undefined memory,
> but it still needs the protection of immutable because... some
> `@system` programmer might want it to point to something
> else... and we can't allow that to happen, because `@system`
> programmers shouldn't be allow to do something like that?
>
> In other words, if it's dangerous enough to start out as
> `@system`, how much additional danger are we adding by making
> it mutable?
You're not adding any additional *danger*, I suppose, but it
would be a non-obvious special case in the type system to have
the `@system` attribute on variables interact with `immutable`
like this. As currently proposed by DIP 1035, they are completely
independent of each other.
More information about the Digitalmars-d
mailing list