Rebooting the __metada/__mutable discussion

Zach Tollen zach at mystic.yeah
Fri Apr 8 14:45:21 UTC 2022


On Friday, 8 April 2022 at 02:32:29 UTC, 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:
>> 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.

It's only non-obvious if you define `@system` variables simply as 
"not usable from `@safe` code." If you defined them as "can also 
override the type system," it *would* be obvious.

The only question is whether this is a good language design. It 
is certainly easy to explain:

Q: "What are `@system` variables?"

A: "They are variables you can do anything you want with, as long 
as it's from `@system` code."

Q: "What are they for?"

A: "They're for doing things you can't do with regular variables, 
and also for marking regular variables as dangerous when the 
compiler can't figure that out on its own."



More information about the Digitalmars-d mailing list