Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112596 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 1215 invoked from network); 22 Dec 2020 16:48:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Dec 2020 16:48:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8C24B1804DD for ; Tue, 22 Dec 2020 08:21:04 -0800 (PST) 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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 22 Dec 2020 08:21:03 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 8F85A35B for ; Tue, 22 Dec 2020 11:21:01 -0500 (EST) Received: from imap26 ([10.202.2.76]) by compute4.internal (MEProxy); Tue, 22 Dec 2020 11:21:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=VdpnGF Fz+NpJpZR1hrbWXUgBNpkiPl299xeRahzHv5Q=; b=r5tYtj9GJmYSVBSqx+ij8d 0he7l4Hf+dTkJX3KLtlWP+Kym4e445HgrK59mnAw712Id32R3OZzF5cYi+OvH3ts r4stbvyYivQDFV1CW1E/W7hlMhCmREtukUfVoW70a1FktFJrXrJ75aQcy5QZfpzR yduSH4wl600MXCj6JBaN5jqN5bbz8hoLJe/lhXyK6/wnZhZKRN2dX4aI3Hg6PXJ7 kiHl5UBNrALPuDaa+1jbW4e5gFk2losQ24of2IxiE40NR9a5uXCBwl+6WodQ13Vm LydBi0MBNzca8gfsKJl9hAmhDVLRnZks9tlS2cgzuZjbzh40kJFRVczuUtyyh8rA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvddtgedgkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreerjeenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeeltddtiedvveeglefhieehtddviefffeehhedvkeeu keffffetkeelgfevvdekteenucffohhmrghinhepvgigthgvrhhnrghlshdrihhonecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhies ghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id AE22014200A2; Tue, 22 Dec 2020 11:21:00 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.1-61-gb52c239-fm-20201210.001-gb52c2396 Mime-Version: 1.0 Message-ID: In-Reply-To: References: <477208c5-331d-671e-a8f4-199a751f0a04@processus.org> Date: Tue, 22 Dec 2020 10:20:40 -0600 To: "php internals" =?UTF-8?Q?iterables?= Content-Type: text/plain Subject: =?UTF-8?Q?Re:_[PHP-DEV]_Straw_poll:_Naming_for_`*any()`_and_`*all()`_on_?= From: larry@garfieldtech.com ("Larry Garfield") On Tue, Dec 22, 2020, at 9:27 AM, tyson andre wrote: > Hi Pierre, > > > This is the kind of reasoning I fully support usually, I do maintain a > > few libraries for multiple PHP versions as most people in this list and > > make things easily polifyllable is something I'm sensible to. > > > > Nevertheless, the language and its standard library has to evolve at > > some point. For enumerable objects PHP terribly lacks a complete and > > convenient API for developers. By putting those methods in the global > > namespace, you make those methods usage much less fluent for many > > developers that uses a decent IDE. It'd be a great thing to have a > > compete OO-based (interface based) API for collection methods. any() and > > all() methods are only the start, in my opinion, of much greater > > improvements in that regard, and I'd very much love to have those > > autocompleted by IDE on pretty much everything that is iterable. > > > > That's just an opinion, I'd love to see it evolve towards an > > object-oriented API. > > 1. If you're talking about adding default methods to Traversables, > default method implementations would be a major RFC of their own > for implementation and discussions on guidelines for using them internally. > > It may raise questions such as "why still have both traits and interfaces". > > Some may object to adding too many default methods to the > completions for an IDE > or naming conflicts in projects. > 2. I'd find it useful to add, though there may be considerable > discussion over what belongs > in an API for collection methods, whether they make sense with > SplObjectStorage, etc. > 3. The pipe operator RFC may be a bit more fluent if a revised version > is accepted - https://externals.io/message/112558#112574 > > `$exists = create_collection() |> user_defined_filter($$) |> > someprefix_any($$)` (possibly different syntax) > > 4. I'd still want to add this functionality for arrays. Limiting > any/all to arrays only would be artificial, > and projects can use both if `->any()` was added by a different RFC > (both count()/Countable->count() syntaxes are used in php code) For those answering in the straw poll, note that the longer the prefix, the uglier chained calls will get. Whether that's done with pipe or something else, expect to be typing that prefix a lot. That's why I am OK with most options except `iterable_`, because that's a lot of needless typing. --Larry Garfield