Setting array length to 0 discards reserved allocation?

Andrew Godfrey via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 27 05:57:58 PDT 2014


>> Conflating both concepts with the same name is why the article 
>> was so dearly needed in the first place.
>
> Except that no concepts are being conflated.

Yes, they are. Consider again the sentence I quoted: "Slicing an 
array means to specify a subarray of it." The word "it" is wrong; 
for it to be correct, it needs to refer to the underlying memory 
block, not the "array".

This was the original cause of my confusion, I believe - it led 
me to think that "T[] is a dynamic array" (by which I mean a 
concept I understand well from other languages) but in fact, D 
has redefined the term "dynamic array" to mean something quite 
different. So, not only is "T[]" NOT the concept I thought it 
was, what it IS apparently goes by the same name as the concept I 
had confused it with! For the sake of increased adoption of D, I 
beg you to reconsider. I am not exaggerating - for a while there 
I thought I was looking at a huge red flag, and if I didn't 
already appreciate other strengths of D, I would have stopped 
there.


More information about the Digitalmars-d mailing list