An exegesis of Walter's reference counted slice

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 24 14:05:51 PST 2015


On 2/24/15 1:33 PM, Ivan Timokhin wrote:
> Is there any plan to allow safe conversions to T[] (in restricted
> circumstances, of course)?

We'd want to avoid it because that would necessitate the whole "scope" 
paraphernalia - e.g you can convert a reference counted slice to 
something like scope(T[]).

A possible option would be to allow the user to go "I want to use GC 
with this slice from now on" which gives back the T[] and lets the GC 
take care of it.

But generally I think we should let reference counted slices and 
built-in slices coexist. Generic range-based code is easy to write so 
factoring the nature of the slice away may be an option.


Andrei



More information about the Digitalmars-d mailing list