Slices and Dynamic Arrays

Tony tonytdominguez at aol.com
Mon Jan 1 05:06:46 UTC 2018


On Monday, 1 January 2018 at 02:10:14 UTC, Jonathan M Davis wrote:

>
> The DLang Tour should probably be fixed to use the term dynamic 
> array though.

Or embrace both terms but take care that it is clear that they 
are synonyms and one may be preferred depending on context. As a 
beginner, I had some confusion seeing both terms used.

There is dual terminology in use outside of dlang.org. The book 
Programming In D says:
--------------------------------------------------------------------
Slice: Another name for dynamic array.

When I write slice I will specifically mean a slice; and when I 
write array, I will mean either a slice or a fixed-length array, 
with no distinction.

Slices

Slices are the same feature as dynamic arrays. They are called 
dynamic arrays for being used like arrays, and are called slices 
for providing access to portions of other arrays. They allow 
using those portions as if they are separate arrays.
-----------------------------------------------------------------------




More information about the Digitalmars-d-learn mailing list