On Saturday, April 02, 2016 15:38:30 Ozan via Digitalmars-d-learn wrote: > On Friday, 1 April 2016 at 20:50:32 UTC, Yuxuan Shui wrote: > > Why? > > > > This is annoying when I need to feed it into a function that > > requires hasLength. > > aa.keys.length
That allocates an array. Doing that would be like doing aa.byKeys().array().length. And associate arrays already have length. You can do auto len = aa.length; The problem is when you want to operate on a range, and the function that you want to pass it to wants length on the range. If byKeys returned a range with length, then that would work, but since it doesn't, it doesn't. Having other ways to get the length doesn't help. - Jonathan M Davis