[Article Contest, first draft] D Slices

Jesse Phillips jessekphillips+D at gmail.com
Wed May 18 13:37:49 PDT 2011


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.

Still reading, but the example should use assertions which pass:

void main()
{
   int[] arr = new int[5];
   shrinkTo2(arr);
   assert(arr.length != 2); // Not expected!
}

It is good form because reading it will describe the outcome even without comment.


More information about the Digitalmars-d mailing list