On Thursday, October 31, 2013 02:46:32 Timothee Cour wrote: > can we support this and similar use cases ? > > import std.range; > void main(){ > auto a=[1,2,3,4]; > auto b1=a.indexed([0,a.length-1]);//OK > auto b2=a.indexed([0,$-1]);//NG > }
Aren't you creating new arrays to pass to indexed here? If that's the case, $ isn't associated with any particular array, and I don't see how it could work. Now, there's issue# 7177 http://d.puremagic.com/issues/show_bug.cgi?id=7177 which aims at getting opDollar to work with ranges which have length (which it generally doesn't at this point), so that might be related to what you're looking for, but if what you're looking for is [0, $-1] to work on its own, I don't see how that could ever work, because $ only works when slicing or indexing, and [0, $-1] in the context above is an array literal. - Jonathan M Davis