Jon_Hull
(Jon Hull)
1
The terms ‘while’ and ‘where’ are too easily confused with each other when used in the same location/context (the word shapes are almost the same).
I am not against adding this functionality, but I would recommend flipping the requirement and using the word ‘until’ instead. I know it means adding an extra keyword, but adding ‘while’ is a recipe for error.
for x in xs until x.something {
}
I haven’t really run into the need for this yet personally (though I use for-in-where fairly often).
Thanks,
Jon
I haven’t really run into the need for this yet personally (though I use for-in-where fairly often).
Yeah.
I haven't weighed in on the `while` thing yet, but, other than its potential usefulness in emulating C-style `for`, I'm just not convinced it's a thing people need that often. Has anyone tried to see how common it is to have a `for` loop whose first statement is an `if` or `guard` and whose body is simply a `break`? That'd be a little complex to search for, but I think it would be pretty helpful in evaluating the need, or lack thereof, for something like `while`.
···
--
Brent Royal-Gordon
Architechies