Idea #1 on integrating RC with GC

Steven Schveighoffer schveiguy at yahoo.com
Tue Feb 4 16:57:06 PST 2014


On Tue, 04 Feb 2014 19:42:55 -0500, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Andrei Alexandrescu:
>
>> auto x = fun().toGC();
>
> Recently I remember Kenji saying that we are now almost able to  
> implement "dup" in library code. If that happens, why don't you call it  
> "dup"?

No, toGC does not create a copy. It just detaches the RC component, and  
relies on GC to clean up the resulting slice (I assume  
typeof(fun().toGC()) == T[])

dup would imply that you wanted a copy in addition to the  
reference-counted version. In fact, you may want a copy that is also  
reference counted.

-Steve


More information about the Digitalmars-d mailing list