Simplification of @trusted
Dominikus Dittes Scherkl
dominikus at scherkl.de
Wed Jun 16 14:24:14 UTC 2021
On Wednesday, 16 June 2021 at 11:38:54 UTC, RazvanN wrote:
> Currently, @trusted applies only to functions. This is most of
> the times a pain when you want trusted code blocks inside
> functions. Why not simplify it a bit by using trusted scope
> blocks? E.g. this:
>
> ```d
> void foo() @safe
> {
> () @trusted { ... }();
> }
> ```
>
> becomes this:
>
> ```d
> void foo() @safe
> {
> @trusted
> {
> ....
> }
> }
> ```
> To make things easier, @trusted does not insert a scope
> (similar to `static if`).
YES PLEASE!
This was suggested since years meanwhile!
(and by the way: the use of @trusted at functions should be
deprecated - a function should either be @save or @system,
nothing in between. Only @trusted blocks should be allowed)
More information about the Digitalmars-d
mailing list