Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109821 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96918 invoked from network); 23 Apr 2020 22:03:37 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Apr 2020 22:03:37 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5EA651804CD for ; Thu, 23 Apr 2020 13:35:36 -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=-0.0 required=5.0 tests=BAYES_40,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS36024 206.123.114.0/23 X-Spam-Virus: No X-Envelope-From: Received: from mail1.25mail.st (mail1.25mail.st [206.123.115.54]) (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 ; Thu, 23 Apr 2020 13:35:35 -0700 (PDT) Received: from [10.0.1.28] (unknown [49.48.242.81]) by mail1.25mail.st (Postfix) with ESMTPSA id D79E960370; Thu, 23 Apr 2020 20:35:28 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Message-ID: <615DAFBB-9F78-4B15-93FF-E694E78F893B@koalephant.com> Date: Fri, 24 Apr 2020 03:35:23 +0700 Cc: php internals To: Larry Garfield X-Mailer: iPhone Mail (17E255) Subject: Re: [PHP-DEV] Any interest in a list type? From: php-lists@koalephant.com (Stephen Reay) > On 23 Apr 2020, at 23:05, Larry Garfield wrote: >=20 > =EF=BB=BFOn Thu, Apr 23, 2020, at 12:02 AM, Matthew Brown wrote: >>> This is the *design* process for a language, and it's important... >> Stepping back to reconsider how collections work generally, and how we ca= n >> improve them in a graceful way that leads to a clean end-state, would be >> very valuable. >> Though you have much more experience with internals than I do, I think th= at >> building a consensus around a bold new vision for PHP collections would b= e >> a near-Sisyphean task. >=20 > Disclosure: I've been around the list for over a decade and talked a lot, b= ut the recent pipe RFC is my first core patch. I'm still one of the little p= eople around here. :-) Though I have successfully engaged in Sisyphean task= s before. (GoPHP5, Drupal 8, FIG, etc.) >=20 >> Adding a list/vector type would be a much smaller, more easily definable >> task =E2=80=93 it was one of the first new types that Hack added, and by a= ll >> accounts they're pretty happy with that decision. >=20 > I think we may be talking past each other. I don't mean "rewrite all the t= hings." Just taking the time to think through "if we have a list type, gene= rators, and array/dicts, what should all of the ancillary bits around them b= e to make them as smooth as possible?" Viz, how do we NOT have array_map, l= ist_map, and generator_map as 3 separate functions, because that would be aw= ful. Are list generators and array/dict generators different things or the s= ame thing, or...? Would comprehensions make sense as part of such a plan? (= IMO yes.) But then, do comprehensions produce lists or dicts or...? =20 >=20 > That's the sort of knock-on effects that should be thought through before w= e commit code, because in the long run it would reduce the amount of code to= commit (and the amount of WTF for users). >=20 > --Larry Garfield >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php Hi Larry, I may be missing something here, but couldn=E2=80=99t the three types be ha= ndled by a set of `iterator_{map,filter,...}` functions? Array_map probably has to stay as is because it=E2=80=99s signature and meth= od of operation is (IMO) not something that should be carried over, but arra= y filter could possibly just become an alias to iterator_filter? Cheers Stephen=