digitalmars.D - Rust style memory management
- Freddy (8/8) Sep 12 2015 So I saw this video:
- Adam D. Ruppe (5/5) Sep 12 2015 Try using the -dip25 switch to dmd, it does one more step in D
- deadalnix (5/10) Sep 12 2015 I really wish we don't move that way. dip25 is at best a glorious
- Enamex (12/20) Sep 12 2015 There's been:
- welkam (5/13) Sep 12 2015 There is something in std.typecons
- deadalnix (3/18) Sep 12 2015 No that's can't provide the guarantee that are wanted here. You
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?
Sep 12 2015
Try using the -dip25 switch to dmd, it does one more step in D toward making a borrow thingy. Nowhere near the level Rust does it, but combined with other library things like destructors, prohibiting copying, etc., it can kinda make a owned thing with borrowed bits.
Sep 12 2015
On Saturday, 12 September 2015 at 20:33:39 UTC, Adam D. Ruppe wrote:Try using the -dip25 switch to dmd, it does one more step in D toward making a borrow thingy. Nowhere near the level Rust does it, but combined with other library things like destructors, prohibiting copying, etc., it can kinda make a owned thing with borrowed bits.I really wish we don't move that way. dip25 is at best a glorious hack and the kind of things that incrase language complexity without giving much in return.
Sep 12 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').
Sep 12 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 is something in std.typecons http://dlang.org/phobos/std_typecons.html Never tried and didnt get into details, but sounds something like rust
Sep 12 2015
On Saturday, 12 September 2015 at 23:21:48 UTC, welkam wrote:On Saturday, 12 September 2015 at 20:17:04 UTC, Freddy wrote:No that's can't provide the guarantee that are wanted here. You can't provides these guarantee without language support.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 is something in std.typecons http://dlang.org/phobos/std_typecons.html Never tried and didnt get into details, but sounds something like rust
Sep 12 2015