Discussion Thread: DIP 1035-- at system Variables--Community Review Round 2
Nick Treleaven
nick at geany.org
Sat Feb 27 10:55:57 UTC 2021
On Friday, 26 February 2021 at 22:29:09 UTC, Max Haughton wrote:
> On Friday, 26 February 2021 at 18:29:26 UTC, Nick Treleaven
> wrote:
>> Er, doesn't private mean module access? This DIP would help
>> verify long modules that might inadvertently access unsafe
>> fields from outside the struct definition, at least in @safe
>> code.
>
> https://run.dlang.io/is/KalIzj
>
> Yes - however code subject to is supposed to be consumed in a
> different module for the most part, so this could be a nice
> side effect but it shouldn't (de jure) guide the actual DIP
> itself.
It's more than a nice side effect - it's actually necessary to
enforce a @safe interface for structs that do unsafe things.
Otherwise changing @safe code can cause memory-safety violations
- that's contrary to the design goal of @safe. It also would in
practice mean a programmer/reviewer would have to read every line
of code in a module every time there was a change - that's not a
sensible design.
More information about the Digitalmars-d
mailing list