Why do "const inout" and "const inout shared" exist?

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 3 13:01:37 PDT 2017


On Monday, 3 July 2017 at 15:48:26 UTC, Petar Kirov [ZombineDev] 
wrote:
> but can you explain exactly what part of Rust's type system 
> provides extra
> benefits in terms of optimization over D's type system?

In safe Rust, a reference to mutable data has to be unique [1]. 
So the optimizer could assume no aliasing as long as the mutable 
borrow lasts.

[1] https://rustbyexample.com/scope/borrow/alias.html


More information about the Digitalmars-d mailing list