On 13 June 2014 13:29, Steven Schveighoffer via Digitalmars-d <[email protected]> wrote: > On Thu, 12 Jun 2014 23:04:08 -0400, Daniel Murphy <[email protected]> > wrote: > >> "Manu via Digitalmars-d" wrote in message >>> >>> and >>> >>> personally, I would expect an 'unreferenced variable' warning for the >>> unused loop counter. I like warnings hassling me about unused >>> variables. >> >> >> This is a good point. > > > In this case, it's being "used" but not by the user.
The compiler doesn't use the result of front(). > The comparison and increment are done behind the scenes. These use popFront() and empty(), not front(). > Note that unused variables typically > are on function parameters and are silenced by naming the type but not the > variable. This request is not in line with that, it is asking for > elimination of the variable and the type, in one special case. How is it a special case? It would be consistent with for(;;) > If it were to be accepted, I'd push for foreach(x) instead of > foreach(;0..x). Cut down all the noise, not just some of it. Fine with me. I'd prefer this too. > foreach over a range doesn't make any sense unless you are using the data. > This is a non-issue IMO. Who says? You can't possibly conceive of a case where the length is the only interesting property? (obviously I'm confronted by the case now, and not for the first time) You'd argue for foreach(_; 0..myRange.length)? That's pretty awkward. Some forward ranges don't have a known length, and can only be summed by an iteration sweep.
