www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Is there an equivalent of Rust owned pointer in D?

reply "Elvis" <pycerl qq.com> writes:
Owned pointer in Rust is a good design IMO, how about D
equivalent?
Aug 05 2013
next sibling parent Nick Treleaven <ntrel-public yahoo.co.uk> writes:
On 06/08/2013 06:26, Elvis wrote:
 Owned pointer in Rust is a good design IMO, how about D
 equivalent?

I think this is about the closest ATM: http://dlang.org/phobos/std_typecons.html#.Unique
Aug 06 2013
prev sibling next sibling parent "Ruslan Mullakhmetov" <nobody example.com> writes:
On Tuesday, 6 August 2013 at 16:32:43 UTC, Nick Treleaven wrote:
 On 06/08/2013 06:26, Elvis wrote:
 Owned pointer in Rust is a good design IMO, how about D
 equivalent?

I think this is about the closest ATM: http://dlang.org/phobos/std_typecons.html#.Unique

would be good to have it as language feature like scoped reference. this clear code (as from c++11 experience abundant std::unique_ptr<T> get me irritated). And of course unique idiom (ownership) get D usable for realtime (removed GC)
Aug 09 2013
prev sibling next sibling parent "Tobias Pankrath" <tobias pankrath.net> writes:
On Friday, 9 August 2013 at 18:16:57 UTC, Ruslan Mullakhmetov 
wrote:
 On Tuesday, 6 August 2013 at 16:32:43 UTC, Nick Treleaven wrote:
 On 06/08/2013 06:26, Elvis wrote:
 Owned pointer in Rust is a good design IMO, how about D
 equivalent?

I think this is about the closest ATM: http://dlang.org/phobos/std_typecons.html#.Unique

would be good to have it as language feature like scoped reference. this clear code (as from c++11 experience abundant std::unique_ptr<T> get me irritated). And of course unique idiom (ownership) get D usable for realtime (removed GC)

While I'm convinced that unique pointers / types are a important concept, especially if combined with immutable. (What's transitive unique/immutable can be cast to immutable .. ), I don't think that just adding a new type modifier will lead D anywhere.
Aug 09 2013
prev sibling parent "Ruslan Mullakhmetov" <nobody example.com> writes:
On Friday, 9 August 2013 at 19:05:26 UTC, Tobias Pankrath wrote:
 On Friday, 9 August 2013 at 18:16:57 UTC, Ruslan Mullakhmetov 
 wrote:
 On Tuesday, 6 August 2013 at 16:32:43 UTC, Nick Treleaven 
 wrote:
 On 06/08/2013 06:26, Elvis wrote:
 Owned pointer in Rust is a good design IMO, how about D
 equivalent?

I think this is about the closest ATM: http://dlang.org/phobos/std_typecons.html#.Unique

would be good to have it as language feature like scoped reference. this clear code (as from c++11 experience abundant std::unique_ptr<T> get me irritated). And of course unique idiom (ownership) get D usable for realtime (removed GC)

While I'm convinced that unique pointers / types are a important concept, especially if combined with immutable. (What's transitive unique/immutable can be cast to immutable .. ), I don't think that just adding a new type modifier will lead D anywhere.

No, I didn't assert that. I just proposed a synthetic sugar =). Unique pointer/types are already in D (at the library level).
Aug 09 2013