Simplification of @trusted

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Wed Jun 16 17:36:46 UTC 2021


On Wednesday, 16 June 2021 at 15:37:22 UTC, H. S. Teoh wrote:
> On Wed, Jun 16, 2021 at 01:00:07PM +0000, kinke via 
> Digitalmars-d wrote:
>> On Wednesday, 16 June 2021 at 11:38:54 UTC, RazvanN wrote:
>> > What do you think?
>> 
>> Absolutely love it, I've wanted this for ages, similar to C# 
>> `unsafe {}` blocks. I absolutely hate the trusted lambdas 
>> 'idiom'.
>
> 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

Yet, it forces to make entire function trusted if lambdas are not 
used, and safe guarantees are lost to remainder of the code due 
to that.

+1 for moving safety qualifiers to code blocks instead of 
functions.

Alex.


More information about the Digitalmars-d mailing list