On Saturday, 16 July 2016 at 21:39:42 UTC, cym13 wrote:
However auto should be allowed here. You are defining a variable and the fact that it's in a foreach shouldn't be of any importance. The language should enforce orthogonality of orthogonal things, not break it. A variable definition in a foreach should be allowed not because I like to be pedantic but because it's allowed everywhere else. That also stands for the principle of least surprise.

actually, `foreach (v; rng)` looks like `foreach` is *reusing* *existing* *variable*. most of the time you can put `immutable` or something like that there to note that it is not reusing (purely cosmetical thing), but sometimes you cannot, and then `auto` is perfect candidate... but it is not allowed. (sigh)

Reply via email to