Our Sister

Manu via Digitalmars-d digitalmars-d at puremagic.com
Fri May 27 21:15:45 PDT 2016


On 28 May 2016 at 10:16, Adam D. Ruppe via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On Friday, 27 May 2016 at 21:51:59 UTC, Seb wrote:
>>
>> not if [] would be ref-counted too ;-)
>
>
> That would be kinda horrible. Right now, slicing is virtually free and
> compatible with all kinds of backing schemes. If it became refcounted, it'd:
>
> 1) have to keep a pointer to the refcount structure with the slice, adding
> memory cost

This is only true for the owner. If we had 'scope', or something like
it (ie, borrowing in rust lingo), then the fat slice wouldn't need to
be passed around, it's only a burden on the top-level owner.
'scope' is consistently rejected, but it solves so many long-standing
problems we have, and this reduction of 'fat'(/rc)-slices to normal
slices is a particularly important one.


More information about the Digitalmars-d mailing list