Luke wrote:

>>        Once C<zip> stops zipping, if any other element has a known finite
>>        number of unexhausted elements remaining, the <zip> fails.
>
> Wow, that's certainly not giving the user any credit.

Actually, I want to be careful because I give the users too much credit. For imagination.


> I'm just wondering why you feel that we need to be so careful.

Because I can think of at least three reasonable and useful default behaviours
for zipping lists of differing lengths:

    # Minimal (stop at first exhausted list)...
    for @names ¥ @addresses -> $name, $addr {
        ...
    }


    # Maximal (insert undefs for exhausted lists)...
    for @finishers ¥ (10..1 :by(-1))  -> $name, $score {
        $score err next;
        ...
    }


    # Congealed (ignore exhausted lists)...
    for @queue1 ¥ @queue2 -> $server {
        ...
    }

Which means that there will be people who expect each of those to *be* the default behaviour for unbalanced lists. Which means there shouldn't be any default for unbalanced lists, since whatever that default is won't DWIM for 2/3 of the potential users. Which means that unbalanced lists ought to produce an error, unless the user specifies how to deal with the imbalance.

Damian

Reply via email to