Simplification of @trusted

Steven Schveighoffer schveiguy at gmail.com
Thu Jun 17 00:34:12 UTC 2021


On 6/16/21 5:32 PM, Paul Backus wrote:
> On Wednesday, 16 June 2021 at 21:26:08 UTC, Bruce Carneal wrote:
>> I like the notion that others have mentioned of @safe checking by 
>> default within @trusted code (which would require @system blocks to 
>> disable checking).  Perhaps we could adopt an opt-in strategy where 
>> such @safe checking is triggered by the presence of an @system block.
> 
> Under this proposal, @system lambdas/blocks within @trusted code would 
> have the exact same semantics as @trusted blocks/lambdas within @safe 
> code currently do. It's pure bikeshedding.

Yes, and that leaves @safe code to actually not require manual checking, 
as opposed to today, where any @safe code with @trusted blocks today 
requires manual checking of all the @safe code (I agree just changing 
trusted/system code this way, and doing nothing with @safe would be 
bikeshedding).

In reality, @safe code should be a function of its inputs, and what is 
considered a safe input. With @trusted lambdas, the inputs are "everything".

-Steve


More information about the Digitalmars-d mailing list