I'm trying to understand the design of ranges. Why does popFront only set the front() property to return the next element in the range? Why not return the element in the call to popFront right away?
For example code like this (which doesn't work since popFront doesn't return): void main() { int[] a = [1, 2]; auto b = a.popFront; assert(a == [2]); assert(b == 1); } Isn't it wasteful to have to call both popFront() and front() to simultaneously remove an element from a range and return it? I mean it's an extra function call, right?