Operator overhaul

Sergey Gromov snake.scaly at gmail.com
Thu Oct 23 06:51:34 PDT 2008


Wed, 22 Oct 2008 21:22:09 -0700,
Russell Lewis wrote:
> > Any other operator-related issues?
> 
> While we're at it, we need to think about lazy slicing (with $).  Say 
> that you have an lazy array type (where it only generates the members 
> when required).  In that sort of situation, you don't necessarily want 
> to generate the entire array (so that you can calculate the length) the 
> first time that somebody does
> 	a = a[0..$-1];
> or
> 	tmp = a[$-1];
> 
> You want to be able to keep a reference that says "so many characters 
> from the end of the array, though the length of the array isn't known yet."

If you have a lazy array, its opSlice(size_t, size_t) can return another 
lazy array, properly configured.  What's the problem?



More information about the Digitalmars-d mailing list