Re: Why is three safety levels need in D?

2016-11-18 Thread Kagamin via Digitalmars-d-learn
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`? Rust has 3 levels of safety: the code inside unsafe block is @system, and the unsafe block as a whole is a

Re: Why is three safety levels need in D?

2016-11-17 Thread Jesse Phillips via Digitalmars-d-learn
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`? https://dlang.org/spec/memory-safe-d.html http://dlang.org/safed.html D makes it illegal for @safe code to

Re: Why is three safety levels need in D?

2016-11-17 Thread Adam D. Ruppe via Digitalmars-d-learn
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

Re: Why is three safety levels need in D?

2016-11-17 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 17 November 2016 at 17:47:21 UTC, Nordlöw wrote: On Thursday, 17 November 2016 at 17:33:33 UTC, Stefan Koch wrote: Memory is inherently unsafe. But it can be treated in a safe way. A language that does not allow you to express a middle ground will have a lot of unsafe code that

Re: Why is three safety levels need in D?

2016-11-17 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 17 November 2016 at 17:33:33 UTC, Stefan Koch wrote: Memory is inherently unsafe. But it can be treated in a safe way. A language that does not allow you to express a middle ground will have a lot of unsafe code that could arguably be seen as safe. So in what way would, for

Re: Why is three safety levels need in D?

2016-11-17 Thread Stefan Koch via Digitalmars-d-learn
On Thursday, 17 November 2016 at 17:29:20 UTC, Nordlöw wrote: On Thursday, 17 November 2016 at 17:27:01 UTC, Stefan Koch wrote: It allows encapsulating unsafe operations in safely-callable wrappers. So is this a limitation in Rust? If so, could you give a more concrete D code example that

Re: Why is three safety levels need in D?

2016-11-17 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 17 November 2016 at 17:27:01 UTC, Stefan Koch wrote: It allows encapsulating unsafe operations in safely-callable wrappers. So is this a limitation in Rust? If so, could you give a more concrete D code example that cannot be implemented with only two safety levels?

Re: Why is three safety levels need in D?

2016-11-17 Thread Stefan Koch via Digitalmars-d-learn
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`? https://dlang.org/spec/memory-safe-d.html http://dlang.org/safed.html It allows encapsulating unsafe