[Article Contest, first draft] D Slices

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Thu May 19 04:42:57 PDT 2011


On Wed, 18 May 2011 14:03:05 -0400, Steven Schveighoffer wrote:

> Having seen quite a few incorrect descriptions of how D slices work
> (particularly regarding appending), I wrote an article that tries to
> describe how D slices work, and why they behave the way they do.
> 
> Being one of the only places where I have web space, it's on my
> dcollections site, I probably will move it to the D wiki eventually, but
> I'm much more familiar with the Trac wiki syntax.
> 
> Please, if you have any comments or recommendations, let me know.  I
> certainly am no author, so I probably screwed a few things up :)
> 
> http://www.dsource.org/projects/dcollections/wiki/ArrayArticle

This is an excellent article!  It answers many questions about the new 
appending system which I've been meaning to ask you for a long time.

One question, still:  It seems inconsistent that the value of capacity() 
normally includes the existing slice elements, yet suddenly returns 0 
when the array cannot be appended to.  Why doesn't it return slice.length?
 
-Lars


More information about the Digitalmars-d mailing list