Simplification of @trusted

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Thu Jun 17 21:19:32 UTC 2021


On Wednesday, 16 June 2021 at 23:52:02 UTC, Bruce Carneal wrote:
> If I understand your meaning here, I disagree.  I think 
> @safe/@trusted is very useful, essential even, in code bases 
> that are changing.  It is a demarcation tool that lets us carve 
> out ever larger safe areas.

Ok, I think I understand better what you meant now.

So, essentially, one is currently forced to make perfectly @safe 
code @trusted because if there is any possibility that a @safe 
method contains a bug (even if 100% unlikely) that affects 
assumptions made in @trusted code then that @safe method can no 
longer be considered safe.

So basically one wants @trusted code to be checked by the 
compiler just like @safe, and then instead explicitly turn off 
the checking in a more narrow unsafe region within the @trusted 
method.

Unless pending DIPs turn out to remove this issue completely. 
Time will show, I guess.






More information about the Digitalmars-d mailing list