Manu's `shared` vs the @trusted promise
jmh530
john.michael.hall at gmail.com
Tue Oct 23 14:20:20 UTC 2018
On Tuesday, 23 October 2018 at 11:24:27 UTC, ag0aep6g wrote:
> [snip]
>
> Instead, maybe we could let @system apply to variables. It
> would forbid accesses from @safe code. Then (strongly) @trusted
> code can rely on them.
>
> Without a language change, an idiom like this might do the
> trick:
> [snip]
We don't need a disruptive, breaking change. @safe currently only
applies to functions. Applying to variables is a first step, but
ideally you would want it to apply like a UDA to arbitrary scopes
as well. That way you can have an @safe part of a function and a
@system part of a function and then have the overall thing be
@trusted and can easily see which is which. It's really more of a
code organization thing than anything else. You could do the same
thing now by just breaking apart the function into multiple
sub-functions.
More information about the Digitalmars-d
mailing list