Rebooting the __metada/__mutable discussion

Zach Tollen zach at mystic.yeah
Fri Apr 8 01:46:35 UTC 2022


On Friday, 8 April 2022 at 01:24:38 UTC, Paul Backus wrote:
> On Friday, 8 April 2022 at 00:37:15 UTC, Zach Tollen wrote:
>> (With DIP1035, mutability is essential to what makes a given 
>> piece of data dangerous enough require being marked `@system`. 
>> And the whole point of `__metadata` is to force mutability 
>> bypassing the type system.)
>
> 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?


More information about the Digitalmars-d mailing list