Smart pointers instead of GC?

Dicebot public at dicebot.lv
Sat Feb 1 00:23:31 PST 2014


On Saturday, 1 February 2014 at 04:33:23 UTC, Frank Bauer wrote:
> Yes, that is what Rust calls an "owning pointer". While we are 
> at it, we might as well dream of "non-owning" or "borrowed" 
> pointers, a.k.a. references in Rust. They don't have an effect 
> on memory-deallocation when they go out of scope, but they 
> prevent the owning pointer they "borrow" from (i.e. are 
> assigned from) from being reassigned to a different object as 
> long as there are borrowing references in scope. There is more 
> to owning and borrowed pointers, but I think that is the 
> essence.

I think D can use simplified model with only `scope`. Using it as 
storage class will effectively make data owned (not necessarily 
pointer), using it as qualifier will allow to "borrow" scope 
reference/pointer, for example, to pass as function argument.


More information about the Digitalmars-d mailing list