develooper Front page | perl.perl5.porters | Postings from June 2021

Re: RFC: Multiple-alias syntax for for

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
June 11, 2021 09:58
Subject:
Re: RFC: Multiple-alias syntax for for
Message ID:
20210611095809.GF16703@etla.org
On Fri, Jun 11, 2021 at 10:38:43AM +0100, Paul "LeoNerd" Evans wrote:
> On Thu, 10 Jun 2021 07:28:16 +0000
> Nicholas Clark <nick@ccl4.org> wrote:
> 
> > What happens here if the list count isn't an integer multiple of 3?
> > 
> > To me, the most obvious answer was substitute undef if it's not
> > (ie don't die, and don't ignore what would be incomplete 'tuples' at
> > the end)
> 
> I'd agree with that. That's also consistent with how my newly-added
> List::Util::zip and ::mesh functions work; documented thus:

Good, and thanks for the confirmation that it wasn't a totally daft idea.

PEP1 has:

    Finally, a proposed enhancement must be "pythonic" in order to be
    accepted by the Steering Council. (However, "pythonic" is an imprecise
    term; it may be defined as whatever is acceptable to the Steering
    Council. This logic is intentionally circular.)


I'm guessing that we want things to be "perlish". Tentatively that seems
to be some blend of

* shown just the code, a perl programmer would guess behaviour consistent
  with the documentation you actually wrote
* looks like it was always part of the language
* behaves consistently with existing similar features - easy to teach


Of course, when you start with a language with

   less a design than a thousand special features flying in close formation

(I can't find the an attribution on that one)

then some of that existing behaviour is undoubtedly something that with
hindsight should have been done differently. So staying consistent with it
is repeating mistakes. You can't always win.


Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About