Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115202 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 82178 invoked from network); 29 Jun 2021 08:05:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Jun 2021 08:05:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 02CBE1804B3 for ; Tue, 29 Jun 2021 01:25:46 -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, 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-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 ; Tue, 29 Jun 2021 01:25:45 -0700 (PDT) Received: by mail-lf1-f46.google.com with SMTP id h15so37919783lfv.12 for ; Tue, 29 Jun 2021 01:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=3Vab9nHzIDeMDdadeSPovpGTrfwiQmjb6jHzjwr2/T8=; b=KXoNiMNRTbh0rEqkG2zfo+YO/t6D+54QPxwExepHjRR20/PibYau4Hz1RZE8alyNJr 5Q+Mi+w8tF+MHFSawGDjNKRTyC3Q1/SNvYb2QGC+QIejeUVyuAKDY3HB4SueKOHxkYcP icCNWe6LI5EawoLSKH9u4Z11sKqwCU/GYQXsoCZQVNu86/ct90KWVQ21Afn15tfY2z8n WfbKX7+8MFNZE9oKA2jcK4kA3s9nfkP8gHjYtLmkuIRtEFdrg6YDy1l8ran63e/qTkpL i4pMV0tJAMt6O1kseCNxFn42w6sWH2fY7PjaJ3QrFj/YevRKV9DNMy37dkdGkiekS7gx nkkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=3Vab9nHzIDeMDdadeSPovpGTrfwiQmjb6jHzjwr2/T8=; b=meeJTpxTcyckl6EZeIztD5Pl3ycy+eX8XSneHyfBdMBIGBPRFax8iuB5Xgu9cSz26G afFciO+iHBHeRuxvL3fJ2pkFea++DnZaaKhOqt4QeqjJegz9ZIDQCdYQCFr7bVX/N3b5 yAIcq5Zn9Zcp3wV7IIF7bMIg9zXSisM2xG1CTGXFuM+YY8IxsczofY7bVOQ4HM9Hk0RK lESfh+sRKwy5MUgEOMrS5i1y+4SYv0cbkZ2SVwcbm3jae9ozD2Uwm+A9BmlsrXKV91Bv StHVdh7hVh1O6gPaPMn8FOAqkha+usi2PxTV2Q0FyWlklrPI3B+/PIaWb3gq6nulGI9R 67Eg== X-Gm-Message-State: AOAM530AbGEyC+eUkvrjFNyJXYibRxaCKzrg0WDfYqlA1bjpd5qlfrDi v/9zAdkAQXJvDk13ahGg2v1cIbNXArNyouZNtj0= X-Google-Smtp-Source: ABdhPJzlTZk037TO2zcizyi0IpMT+kQcJIepsW5BXNeAPrVjeJjtkz2cf12VMgHksMr0bsZLCEdVUhtTwxwl9a/MbBQ= X-Received: by 2002:a19:f11d:: with SMTP id p29mr22355092lfh.165.1624955142839; Tue, 29 Jun 2021 01:25:42 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab3:7506:0:0:0:0:0 with HTTP; Tue, 29 Jun 2021 01:25:42 -0700 (PDT) In-Reply-To: <13476e3c-93d6-4c6f-be9e-24f46a5049fb@www.fastmail.com> References: <43d612c0-7462-463a-9536-ed5b66d9ae1e@www.fastmail.com> <13476e3c-93d6-4c6f-be9e-24f46a5049fb@www.fastmail.com> Date: Tue, 29 Jun 2021 10:25:42 +0200 Message-ID: To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Pipe Operator, take 2 From: olleharstedt@gmail.com (=?UTF-8?Q?Olle_H=C3=A4rstedt?=) 2021-06-29 0:54 GMT+02:00, Larry Garfield : > On Mon, Jun 28, 2021, at 5:30 PM, Olle H=C3=A4rstedt wrote: > >> Mm. Assoc arrays are by now known to be not so good. I hope... > > There are millions of PHP sites build on anonymous arrays today. > >> OCaml is strictly evaluated, not lazy like Haskell. So the order might >> matter, dunno, I don't use this operator often. :) My point was mostly >> that it's very easy to add in OCaml - just one line. And as in >> Haskell, you can define operators in your modules. Similarly, in PHP >> it's easy to do super-dynamic stuff like "new $someclass", which is >> not remotely possible in FP (good or bad, depending on your religion). >> >> Adding a new pipe keyword is like the list() keyword, kind of. A bad >> idea, haha. But I think all stones can be turned, if this RFC now gets >> a no. :/ >> >> Would a slimmed down version have more support? How about removing the >> variadic operator, and let the user manually add the lambda for those >> cases? Could reduce the complexity while still covering maybe 80% of >> the use-cases? Same with removing support for named arguments. So '?' >> would only be a short-cut to get rid of boilerplate like `$strlen =3D >> fn($x) =3D> strlen($x)`. > > I talked with Joe about this, and the answer is no. Most of the complexi= ty > comes from the initial "this is a function call, oops no, it's a partial > call so we switch to doing that instead", which ends up interacting with = the > engine in a lot of different places. Once you've done that, supporting o= ne > placeholder or multiple, variadics or not, etc. is only a small increment= al > increase in complexity. > >> > Overall, I really don't like the idea of special-casing pipes to chang= e >> > what >> > symbol table gets looked up. >> >> Still wondering if this could be a per-file or per-library setting >> somehow, to opt-in into pipe behaviour when so desired. Or rather, to >> opt-in into this or that behaviour needed to do more idiomatic pipe. >> >> Here's one boilerplaty pipe: > > *snip* > > We're in the pipe thread here, not PFA. :-) And really, you're solving t= he > wrong problem. Pipes are trivial. They're only clunky because of PHP's > lack of decent callable syntax. PFA gives us that, but the engine makes = the > implementation more complex than it seems like at first glance. > > Trying to come up with complex workarounds to make pipes pretty without > helping anything else is a fool's errand, especially when we have a worki= ng > PFA RFC that's about to end voting. (And right now is losing by a very s= lim > margin, but could pass if a few people change their minds.) > > Aside from something like Nikita's ...-only function reference RFC, which > only handles half the problem (it doesn't do anything to make multi-arg > functions work with pipes at all), any other solution is going to end up > reinventing PFA one way or another, or reinventing existing ugly user-spa= ce > libraries. one way or another > > I've not yet decided if I'm going to bring pipes to a vote if PFA doesn't > pass. I'm tempted to, but it would require rewriting all the RFC text ba= ck > to the uglier version without PFA, and yeah, it's not going to look as > pretty. And the main pushback a year ago when I first brought it up was > "PFA first, please, so the callable syntax isn't ugly." And... here we > are. > > --Larry Garfield Is there no "pre-vote" process for RFCs? For example, letting the voting members *rate* different alternatives, in a ranking fashion, to see which one is most and least popular. Feels like a lot of work is getting wasted if something is voted down on a small margin. Olle