Rebooting the __metada/__mutable discussion

Zach Tollen zach at mystic.yeah
Fri Apr 8 00:37:15 UTC 2022


On Wednesday, 6 April 2022 at 09:41:52 UTC, RazvanN wrote:
> What do you think? Am I missing anything? If you think this 
> could fly, I could update the DIP and submit it.

It strikes me that this DIP is eerily similar to the `@system` 
variables described in 
[DIP1035](https://github.com/dlang/DIPs/blob/72f41cffe68ff1f2d4c033b5728ef37e282461dd/DIPs/DIP1035.md) which is in the final phase of the review process. It seems perfectly possible to merge the characteristics of `__metadata` as described here, with the characteristics of `@system` variables in that DIP.

The effect would be that basically, you can do *anything* with 
`@system` variables — except access them in `@safe` code, which 
is precisely the point. You can violate the type system. You have 
total freedom. And that's that.

I suppose the downside is that one might not *desire* to have all 
that freedom. But I'm trying to think of any situation where you 
would want a `@system` variable to be immutable. The whole point 
of both `@system` and `__metadata` in the two DIPs, is that 
`@system/__meta` data is mutable. (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.)

-- Zach



More information about the Digitalmars-d mailing list