Slices and Dynamic Arrays

Tony tonytdominguez at aol.com
Fri Dec 29 22:32:01 UTC 2017


In DLang Tour:Arrays
https://tour.dlang.org/tour/en/basics/arrays

there is:
-----------------------------------------------
int size = 8; // run-time variable
int[] arr = new int[size];

The type of arr is int[], which is a slice.
-----------------------------------------------

In "D Slices"
https://dlang.org/d-array-article.html

there is:
-----------------------------------------------
int[] a;             // a is a slice
------------------------------------------------

Based on those two web pages it appears that the name for a 
dynamic array <reference?> in D is "slice". That is, anytime you 
have a dynamic array (even a null reference version) it is called 
a slice. Is that correct?


More information about the Digitalmars-d-learn mailing list