Is @trusted the wrong direction?

Dominikus Dittes Scherkl dominikus at
Sat Nov 9 21:30:29 UTC 2019

On Saturday, 9 November 2019 at 18:33:09 UTC, Jonathan M Davis 
> Really, the fact that @trusted is at the function level is just 
> an unnecessary complication. From the caller's perspective, 
> @safe and @trusted are identical.
Yes. Three state enums are always clumsy, especially so if they 
are useless - and even not obviously so but you have to think 
about it every time to figure that out.

> Sometimes, it does make sense to use @trusted on large blocks 
> of code, but most of the time, it doesn't,
Really almost never.

> and it makes it a lot harder to figure out what exactly was 
> @system that needed to be @trusted when a lot of code was 
> @trusted at once.
And even if that is really necessary, it would be no problem to 
declare a trusted block containing the whole function body. But 
from the outside the function is @safe, that's all that matters 
to the caller.

More information about the Digitalmars-d mailing list