I wonder if there are even good real world use cases for this feature. I mean, EEP 19 and thereby the idea of zip generators has been out since 2008, yet I have never heard anyone asking for it.
For lists (list generators), there are certainly many cases where it could be useful, but then again we already have the lists:zip
family of functions for that, which lately even gained the ability to work with lists of different lengths. And while they can only zip up 2 or 3 lists, in more than 10 years I never had the need to zip up more, at least I don’t remember any such case.
For binaries (binary generators), there may be some rare cases, but I can’t think of any. Why would you want to zip up two or more binaries, or binary/list combinations? Even if, while there are no binary:zip
functions, I would consider this such a rare case that it doesn’t justify a dedicated language construct.
For maps (map generators), this feature makes no practical sense at all. The iteration order of map generators is undefined, so one would have to use iterators with a defined order there. The “simple” orderings ordered
and reversed
use map-key order, which is probably also not all too useful here, so one would have to use a tailored ordering function. This definitely outweighs any convenience gained by using the zip generator functionality.
That all said, it seems to me that this feature only introduces something nice to have, implemented just because it can be done. And once it is in the language, it has to be maintained even if nobody uses it.
I also object to &&
, it positively jumps out at me (that is, more than it should) and hurts my eyes The proposed alternative of ;
OTOH does not jump out at me enough.
Seriously though, it is highly confusing for me, and probably more so for people coming from other languages. In all other languages I know, &&
means “boolean and
”, and ||
is its sibling meaning “boolean or
”. And yes, in the zip generator context here, &&
means something and-ish, also. However, ||
which we also have and to which &&
is bound to appear in close proximity in the code, means something entirely different: it separates the expression part from the generators and filters part of a comprehension. And while the ||
as of now could also be confusing to people coming from languages where it means “boolean or
”, it can be justified by framing it as being closely related to the |
used for consing; the &&
however can not be framed this way, there is no &
to which it may allude.