@trusted attribute should be replaced with @trusted blocks

Dominikus Dittes Scherkl dominikus at scherkl.de
Fri Jan 17 09:39:42 UTC 2020


On Friday, 17 January 2020 at 09:21:30 UTC, Dominikus Dittes 
Scherkl wrote:
> On Friday, 17 January 2020 at 08:10:48 UTC, Johannes Pfau wrote:
>
>> I'm curious, what do you think would be the ideal scheme if we 
>> could redesign it from scratch? Only @safe/@system as function 
>> attributes and @trusted (or @system) blocks which can be used 
>> in @safe functions?
>
> Yes, pretty much the same as in Rust.
> And we can get there: just need to introduce @trusted blocks 
> (which would not a change what is already possible but only a 
> simplification of syntax) and changing all @trusted functions 
> to @safe (with one big @trusted block around the function body).
>
> These are pretty small changes, but would yield a much better 
> structure.

And by the way: I would not call the blocks @system, they should 
be distinguishable from @system functions to make them better 
searchable!

I still think the @trusted blocks should be rare and small and 
only necessary at the lowest level deep within libraries.


More information about the Digitalmars-d mailing list