Rust style memory management

Enamex via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 12 13:35:33 PDT 2015


On Saturday, 12 September 2015 at 20:17:04 UTC, Freddy wrote:
> So I saw this video: 
> https://air.mozilla.org/guaranteeing-memory-safety-in-rust/ and 
> was amazed. Is there any way we can implement this in D? What 
> language extensions would be required?
>
> My idea on implement this would be to add 3 new pointer (and 
> array) types : [owned,shared immutable,borrow mutable] and 
> depend on casting raw pointers to the new types.
>
> Thoughts?

There's been:
http://wiki.dlang.org/User:Schuetzm/scope1
http://wiki.dlang.org/User:Schuetzm/scope2
http://wiki.dlang.org/User:Schuetzm/scope3

And at least one earlier proposal that's been accepted already. 
It requires the '@safe' annotation to work and is quite limited 
to anything more general. Although the basic opinion was that it 
covered a large proportion of the inherently unsafe cases that 
Rust aims to cover compared to C++ or unsafe D (but Rust's 
approach is more 'safe by proof' vs D's 'safe by prohibiting 
known unsafe').


More information about the Digitalmars-d mailing list