Why is three safety levels need in D?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 17 10:13:14 PST 2016


On Thursday, 17 November 2016 at 17:18:27 UTC, Nordlöw wrote:
> Why does D need both `@safe`, `@trusted` and `@system` when 
> Rust seems to get by with only safe (default) and `unsafe`?

I'm pretty sure the Rust `unsafe` just does both D's `@system` 
AND `@trusted`.

An unsafe function in Rust is like a D @system function.

But an unsafe *block* in Rust, as I understand it, behaves more 
like D's @trusted - it lets you call unsafe functions from inside 
a safe function.


More information about the Digitalmars-d-learn mailing list