On Fri, 11 Nov 2011 07:03:33 -0500, Jonathan M Davis <jmdavisp...@gmx.com>
wrote:
On Friday, November 11, 2011 11:46:02 RenatoL wrote:
int[7] arr = [1,2,3,4,5,6,7];
writeln(arr[$..$]);
this simply prints a newline... I expected a runtime error (or better
a compile time error) but it does nothing ... why?
Probably because it's length is zero and therefore isn't actually a
slice of
the original array at all. It wouldn't surprise me if arr[500 .. 500]
worked
exactly the same way. Because the array is empty, it doesn't really
matter
what values you gave it.
I would just make a minor correction that it *is* a slice of the original
array. It's just an empty slice.
BTW, I would have expected the output:
[]
(and testing, I see it does do this).
-Steve