Rebooting the __metada/__mutable discussion

Timon Gehr timon.gehr at gmx.ch
Fri Apr 8 08:23:34 UTC 2022


On 08.04.22 04:32, Paul Backus wrote:
> 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.

Yes. I do not understand why so many people are so keen to conflate 
entirely different things into the same concepts. That's just bad 
language design.


More information about the Digitalmars-d mailing list