Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111814 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88852 invoked from network); 3 Sep 2020 13:13:16 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Sep 2020 13:13:16 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3EB0B1804E3 for ; Thu, 3 Sep 2020 05:18:23 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 3 Sep 2020 05:18:22 -0700 (PDT) Received: by mail-lj1-f176.google.com with SMTP id b19so3365559lji.11 for ; Thu, 03 Sep 2020 05:18:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KhtqJ/eUsHMUlw+EP8i/7/IrHBjj3zkRO6/3K2flLpU=; b=R2d6ovysd65+97GMHQnqe0lRT+ALRMnojfu6x95koYA58+JzUZWYlFR+Tip6jRUqwh VPENnP3+QiViQVG6S4NupabeJuu++ePw4Gm2Er66YSIoFb4e5kTUTp2QQ2In7LGALNT0 0nLgoSgwCQIWp9tqhxNmiKip8fYB8VU45EpJbgkpXUBdh0fDRPhmnxAo8iztEU+B94PX YuFNOhKGIPtcw4DoBdD0L5cNa44ssU41rkWvl3wcMNXZNAeW1YpDOpTM5OKIR4e+cIcT LoNYYS0a1kOAF0z8WT2XGCFlbuOKWlFet3Ms8UYf6mteEt2VCevbUF4ikDZcHV0VHa3E JTJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KhtqJ/eUsHMUlw+EP8i/7/IrHBjj3zkRO6/3K2flLpU=; b=kdUWqSj7zUmUfnF1TYOnPqAifMJr3Rha9wwa98Uc5hFMMQxPjjp+3+nHSZqC/DxV4I K3Gq2FqZVVzBCsSm14veqkQDfgA7I3RYaUIUZAptZxRhvx4yLMYsqB0WsjdjxOe6hFip 0WiWcFmxSERjOnmPwqlhdSGD4de/g23gvEae3AGgM87bjiGeCfw5MXiv6PaBZhAmhWcr CqK2IgRI7VyZwuIxnu076ZWRKnEfscoCIfCuzbDcnurXhCv/qSLLmiDk370xkSRnGbhK fbvMTfEd2DTHi4yuRVOcUqqSCpx3YGC7DRAwslwZ0Evu91sGnYmjya6GjhLedVTHDOio /5Rw== X-Gm-Message-State: AOAM533j5/VNLrX4ixTUUZi1Y3QkUp6eUYEgTxPOtQ7B/bulo78TjJw8 bjVOpO0LRSJsq0Tvzee1ezmOUwcyGUiB0pKeCt0G5J01W0OZlA== X-Google-Smtp-Source: ABdhPJxYWqTY06G9mo65eJm2TKZFipXUA9/E21hYdWW3JGWfKQMPfL5rrejmk2MwrbXJQAVBRXVvnfVetsXHFBx4/rg= X-Received: by 2002:a05:651c:290:: with SMTP id b16mr1066925ljo.307.1599135497382; Thu, 03 Sep 2020 05:18:17 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 3 Sep 2020 14:18:01 +0200 Message-ID: To: tyson andre Cc: Lynn , PHP internals Content-Type: multipart/alternative; boundary="00000000000044f0f505ae67bf0b" Subject: Re: [PHP-DEV] [RFC] Global functions any() and all() on iterables From: nikita.ppv@gmail.com (Nikita Popov) --00000000000044f0f505ae67bf0b Content-Type: text/plain; charset="UTF-8" On Wed, Sep 2, 2020 at 1:54 AM tyson andre wrote: > Hi Lynn and Nikita, > > > To be in line with naming conventions, I would suggest calling these > > iter_any() and iter_all(), using iter_* as the prefix for our future > > additions to the "functions that work on arbitrary iterables" space. > > iterable_any() and iterable_all() would work as well, though are > > unnecessarily verbose. > > I'd also feel like iter_any() could get confused with iterator_apply() for > Traversable > in terms of whether it's shorthand for iterator or iterable when learning > the language. > > There's been more discussion than I expected on this, arguments for both > options, and I'm not sure what the overall sentiment of voters is. > I was considering creating a straw poll on the wiki with 2 questions to > guide the final version of the RFC/PR: > > 1. Name choice (iterator_all(), iter_all(), or all(), or no interest in > adding the functionality) > 2. Interest in future RFCs to extend support to keys and entries > > Thanks, > - Tyson The main thing I'm concerned about is that once we start extending this area (I assume that any & all are not going to be the last additions in this space) we will quickly run into function names that are either too generic or outright collide. For example, what if we want to add an iterator-based version of range()? Do we *really* want to be forced to pull a Python and call it xrange()? That's about as good as real_range()... As such, I think it's important to prefix these *somehow*, though I don't care strongly how. Could be iter_all() or iterable_all(). We might even make it iterator_all() if we also adjust other existing iterator_* functions to accept iterables. I'd also be happy with iter\all() or iterable\all(), but that gets us back into namespacing discussions :) Regards, Nikita --00000000000044f0f505ae67bf0b--