Nested slicing

Koroskin Denis 2korden+dmd at gmail.com
Mon Mar 31 06:59:21 PDT 2008


One last thing about dollar notation in array slicing.
Shouldn't the following piece of code generate a compile-time error?

import std.stdio;

int main()
{
     int[] outer = [0, 1, 2, 3, 4];
     int[] inner = [5, 4, 3, 2, 1];

     int[] slice = outer[0..inner[$-1]]; < Error: shadowing declaration  
__dollar is deprecated

     writefln(slice.length);

     return 0;
}



More information about the Digitalmars-d mailing list