Temporary @trusted scope

Simen Kjærås simen.kjaras at gmail.com
Wed Dec 19 15:57:06 UTC 2018


On Tuesday, 18 December 2018 at 13:52:29 UTC, Steven 
Schveighoffer wrote:
> On 12/18/18 6:29 AM, Simen Kjærås wrote:
>> @safe unittest {
>>      unsafe!({
>>          fun(2);
>>      });
>> 
>>      unsafe!fun(2);
>> }
>
> Wow, I really like this. The only real problem is that one 
> generally searches for @trusted when looking for unsafe code, 
> but unsafe is pretty obvious too. Also, args should be auto ref.

While @trusted wouldn't work, it could be named 'trusted' instead 
of 'unsafe'. That's not gonna help those who search for 
'@trusted', but it's closer, at least.

--
   Simen


More information about the Digitalmars-d-learn mailing list