Simplification of @trusted

RazvanN razvan.nitu1305 at gmail.com
Wed Jun 16 16:01:16 UTC 2021


On Wednesday, 16 June 2021 at 15:37:22 UTC, H. S. Teoh wrote:

>
> This isn't the first time it was suggested.  Way back when, it 
> was brought up and rejected because Walter thought that 
> @trusted blocks should be discouraged, and therefore should be 
> ugly to write.  It was extensively argued, but Walter preferred 
> the "trusted lambda idiom", precisely because it was ugly, 
> required effort to write, and therefore deters casual (ab)uses 
> of @trusted.
>
>
> T

I think that the time to reassess that decision has come. In 
reality, trusted is needed to write **optimized** safe code. 
Since there are a lot of scenarios where trusted is needed we 
should simply accept it and make it easy to use.

Another counter argument is that it is so much easier to trust 
the entire function (instead of using trusted lambdas), that the 
previous design decision ends up causing more bad than good.


More information about the Digitalmars-d mailing list