@trusted attribute should be replaced with @trusted blocks

jmh530 john.michael.hall at gmail.com
Fri Jan 17 19:11:21 UTC 2020

On Friday, 17 January 2020 at 18:12:21 UTC, Timon Gehr wrote:
> [snip]
> They really do, and the fact that many people do not understand 
> this is a pretty solid argument against Rust's `unsafe` 
> keyword. In Rust, the `unsafe` keyword is overloaded to have 
> dual meanings. Functions with `unsafe` blocks are trusted 
> functions. Functions annotated `unsafe` are system functions.

Ah, that is correct. I had not even realized it.

Some of the discussion on this thread and some others recently 
who are skeptical of @trusted would thus find this useful. Rust 
has the equivalent of @system and @system blocks, but no 
equivalent keyword to express @trusted. At the same time, they 
are also having problems with people marking too much code as 
their equivalent of @system, contributing to problems in their 
community. This would suggest removing @trusted should have a 
very high bar.

More information about the Digitalmars-d mailing list