Would the ownership model make D lang as complicated as Rust?
snarwin at gmail.com
Wed Nov 18 01:29:37 UTC 2020
On Wednesday, 18 November 2020 at 01:21:12 UTC, Walter Bright
> On 11/15/2020 6:34 AM, Timon Gehr wrote:
>> And an unsound interface between the two so you can have your
>> O/B and safety type checks and even get the luxury of some
>> memory corruption anyway.
> In Rust there are unsafe (i.e. unsound) functions, too. It's
> not possible to make Rust work without them.
In Rust, the borrow checker is still enabled in unsafe functions:
> You can take five actions in unsafe Rust, called unsafe
> superpowers, that you can’t in safe Rust. Those superpowers
> include the ability to:
> * Dereference a raw pointer
> * Call an unsafe function or method
> * Access or modify a mutable static variable
> * Implement an unsafe trait
> * Access fields of unions
> It’s important to understand that unsafe doesn’t turn off the
> borrow checker or disable any other of Rust’s safety checks: if
> you use a reference in unsafe code, it will still be checked.
More information about the Digitalmars-d