On Tuesday, January 08, 2013 20:32:29 Joseph Rushton Wakeling wrote:
> On 01/08/2013 08:09 PM, Jonathan M Davis wrote:
> > It's a hard fact. Some features (e.g. appending to an array) require the
> > GC
> > and will always require the GC. There may be features which currently
> > require the GC but shouldn't necessarily require it (e.g. AAs may fall in
> > that camp), but some features absolutely require it, and there's no way
> > around that.
> ... but there is also std.container.Array which if I understand right, does
> its own memory management and does not require the GC, no?
> 
> Which leads to the question, to what extent is it possible to use built-in
> arrays and std.container.Arrays interchangeably? What are the things you
> can't do with a std.container.Array that you can with a built-in one?

std.container.Array and built-in arrays are _very_ different. Array is a 
container, not a range. You can slice it to get a range and operate on that, 
but it's not a range itself. On the other hand, built-in arrays aren't true 
containers. They don't own or manage their own memory in any way, shape, or 
form, and they're ranges. The fact that an array _is_ a slice has a _huge_ 
impact on arrays, and that's not the case with Array. And of course, the APIs 
for the two are quite different. They're not really interchangeable at all.

True, you can use Array in a lot of places that you can use built-in arrays, 
but they're fundamentally different, and one is definitely _not_ a drop-in 
replacement for the other.

- Jonathan M Davis

Reply via email to