Simplification of @trusted

Bruce Carneal bcarneal at gmail.com
Wed Jun 16 21:26:08 UTC 2021


On Wednesday, 16 June 2021 at 18:28:48 UTC, Timon Gehr wrote:
> On 16.06.21 13:38, RazvanN wrote:
>> 
>> 
>> What do you think?
>
> @trusted nested functions are an antipattern and this enshrines 
> them in a language feature.

Yes.

Making it trivial to circumvent @safe weakens it broadly and 
across time.  I would rather see the language move towards more 
readable/maintainable safety dependencies and additional 
automated checking.

I like the notion that others have mentioned of @safe checking by 
default within @trusted code (which would require @system blocks 
to disable checking).  Perhaps we could adopt an opt-in strategy 
where such @safe checking is triggered by the presence of an 
@system block.

If adopted, we might later move to 
@safe-within- at trusted-by-default via compiler flags or module 
attributes or ...



More information about the Digitalmars-d mailing list