@safe accessing of union members
Paul Backus
snarwin at gmail.com
Thu Mar 18 23:46:59 UTC 2021
On Thursday, 18 March 2021 at 23:37:26 UTC, ag0aep6g wrote:
> Allowing an @safe constructor to set a @system variable might
> be a mistake. This was pointed out in the DIP review. But
> auditing all @safe constructors is still less work than
> auditing all @safe code.
It's definitely not ideal, but it's necessary given the
language's current limitations. Constructors are subject to
special restrictions [1] that do not apply to most D code, and
those restrictions make proper use of @trusted escapes impossible.
I believe this is mentioned somewhere in the DIP, but it probably
deserves more attention, since this is a relatively obscure
corner of the language.
[1] https://dlang.org/spec/struct.html#field-init
More information about the Digitalmars-d
mailing list