Setting array length to 0 discards reserved allocation?

Andrew Godfrey via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 29 00:46:33 PDT 2014


On Sunday, 27 July 2014 at 05:51:46 UTC, Jakob Ovrum wrote:
> On Saturday, 26 July 2014 at 23:06:02 UTC, Andrew Godfrey wrote:
>> Thereafter can come sub-slice examples and so on.
>> Does this make sense?
>
> Yes, the reference documentation is pretty terrible with naming 
> of various array concepts.
>
> IIRC, when this was discussed in the past, a majority seemed to 
> be in favour of using "slice" and "dynamic array" for their 
> respective concepts instead of the current situation, but I 
> also remember there was some opposition (for reason I can't 
> remember). A pull request updating the documentation to use 
> slice/dynamic array might weed them out ;)

I gave this a try, and overall it looks like an improvement, but 
I think we need another name than "slice". The reason is that the 
slice operator is a distinct thing and interacts with the "slice" 
in strange ways. When I next get time I'll try updating it to use 
the term "array reference". That is:

int[] a; // defines an array reference, a
int[3] b;
a = b[1..3]; // updates the array reference a to refer to a slice 
of b


More information about the Digitalmars-d mailing list