@trusted attribute should be replaced with @trusted blocks

Steven Schveighoffer schveiguy at gmail.com
Fri Jan 17 14:46:56 UTC 2020


On 1/17/20 4:39 AM, Dominikus Dittes Scherkl wrote:
> 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.

@system blocks would only live inside @trusted functions. So you can 
search for @trusted, and then look for the system blocks to see which 
parts need attention.

-Steve


More information about the Digitalmars-d mailing list