On 3/17/21 10:21 AM, jmh530 wrote:

> That's a little advanced, I think. And you also have
> http://ddili.org/ders/d.en/slices.html
> saying that slices are just another name for dynamic arrays.

I don't fully agree with myself there. :) Slices are interfaces to many different kinds of consecutive objects: nameless dynamic arrays owned by the GC, static arrays, dynamic arrays managed by the programmer, etc.

The conflation stems from the fact that the storage for the slice becomes "a dynamic array owned by the GC" as soon as new storage is needed: appending, concatenation, and increasing the length. The slice leaves its existing storage just like that.

Ali

Reply via email to