On Thursday, 30 May 2013 at 06:12:03 UTC, Ali Çehreli wrote:
On 05/29/2013 10:54 PM, Maxim Fomin wrote:
> And this is a problem, because article about D slices
encourages to call
> some raw memory (which almost never is directly manipulated
and doesn't
> appear in source code) as a dynamic array, and dynamic array
as a slice.
An array is simply consecutive elements in memory. There are
two types of arrays: static (aka fixed-length) and dynamic.
As a general programming notion - yes, in D (array spec page):
"Dynamic arrays consist of a length and a pointer to the array
data."
This actually kills two misinterpretations encouraged by array
article that a) dynamic array is some kind of runtime memory b)
that T[] data is not a dynamic array, it is a slice.
Slice is not an array itself: It is both an accessor to array
elements (static or dynamic) and a tool that can spawn a new
dynamic array when another element is appended to its view.
Documentations use "slice" and "dynamic array" synonymously
because of the latter semantics.
Ali