On 20/09/13 17:22, H. S. Teoh wrote:
Which makes it even more confusing, since newbies would probably equate
arrays (the container) with ranges from their frequent use in range
examples.

Yes, it's completely non-obvious. I think the first time I realized the range/container distinction was when I tried experimentally replacing some built-in arrays with std.container.Array and discovered that I couldn't use them in a foreach loop.

Perhaps it's more useful to think of T[] not as an array per se, but as
a *slice* of the underlying array data which is managed by druntime. I
think I'm OK with saying that arrays (i.e. the underlying data) are
containers, while slices (what we think of today as "arrays") are
ranges.

It's not a bad description, but I'm not sure that takes into account the const(T[]) case.

Reply via email to