On 1/1/18 12:18 AM, Jonathan M Davis wrote:

A big problem with the term slice though is that it means more than just
dynamic arrays - e.g. you slice a container to get a range over it, so that
range is a slice of the container even though no arrays are involved at all.
So, you really can't rely on the term slice meaning dynamic array. Whether
it does or not depends on the context. That means that the fact that a
number of folks have taken to using the term slice to mean T[] like the D
Slices article talks about tends to create confusion when the context is not
clear. IMHO, the D Slices article should be updated to use the correct
terminology, but I don't think that the author is willing to do that.
The problem with all of this is that dynamic array is a defined term *outside* of D [1]. And it doesn't mean exactly what D calls dynamic arrays.

This is why it's confusing to outsiders, because they are expecting the same thing as a C++ std::vector, or a Java/.Net ArrayList, etc. And D "array slices" (the proper term IMO) are not the same.

I'm willing to change the article to mention "Array slices" instead of just "slices", because that is a valid criticism. But I don't want to change it from slices to dynamic arrays, since the whole article is written around the subtle difference. I think the difference is important.

-Steve

[1] https://en.wikipedia.org/wiki/Dynamic_array

Reply via email to