Yeah, there was a proposal long ago to remove where
from for-in
loops, but it was rejected (thankfully.) I do have mixed feelings about the name. (Part of me thinks it should have been renamed guard
)
I think the problem I have with having optional binding on the where
is that given for-in
's ability to already do pattern matching on the LHS, you would now have a blur between checking a boolean, and matching a pattern on a construct that can already do pattern matching elsewhere. Why not just remove where
and merge its functionality with the LHS? That would bring it inline with guard
. And because where
is settled at this point we can't do that.
So I think the question is do we expand where
to match what guard
can do, or allow multiple patterns to be matched on the LHS of the for loop (or do nothing of course.)