Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115287 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 74542 invoked from network); 4 Jul 2021 14:18:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Jul 2021 14:18:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A40FF1804C8 for ; Sun, 4 Jul 2021 07:39:42 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,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 out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (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 ; Sun, 4 Jul 2021 07:39:42 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 595FA5C0047 for ; Sun, 4 Jul 2021 10:39:40 -0400 (EDT) Received: from imap43 ([10.202.2.93]) by compute1.internal (MEProxy); Sun, 04 Jul 2021 10:39:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=fm3; bh=CLPhr7JKtAkPkVDF0C0879zEYDUS/QlfkIE8ESliP RM=; b=gvTtPJNALxit+dkjmvdhBRNyrrKc0DQRFt1yt6S/oRxYgtAj2/7S7mlV8 wjbiVd9AlxtAAapgMiIQCVT0BUgDtiZ5Hg0dP2QefIoq23BSF7IBYQhQf3/Y2uhW hwcBSPlF2xJbxFykro41c3Y55Mh37jnNj0zqJQw6P78FjTVmE+JHy862RNn4AvCd Yevfy9RhrhG3Vr988rwJwOvdzhnACw6Vrf6WXFiYxVWd3WQJooahlCPs3wvZ0itM juL6CElZRXDZmIOBChkJkZHd2dN4UdKV7UDQ8cXD5edGaMR5Fiz4ZQHY2iO+du2Y GoaZQTKQ7MvqTDGYcuTFL24UqfGsg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeejvddgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepheetvdehffekieeiffffueevhfeugfegfeelgfef feeutdejheeileefvdekveelnecuffhomhgrihhnpehphhhprdhnvghtpdhgihhthhhusg drtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhm pehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id D3485AC0073; Sun, 4 Jul 2021 10:39:39 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-530-gd0c265785f-fm-20210616.002-gd0c26578 Mime-Version: 1.0 Message-ID: <1d68c017-1f52-4670-b3cb-f2597bd28032@www.fastmail.com> In-Reply-To: References: <63aa426c-30bc-4f00-8740-532fa0bef6f2@www.fastmail.com> Date: Sun, 04 Jul 2021 09:38:25 -0500 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Pipe Operator, take 2 From: larry@garfieldtech.com ("Larry Garfield") On Sun, Jul 4, 2021, at 2:18 AM, Olle H=C3=A4rstedt wrote: > 2021-07-04 4:12 GMT+02:00, Larry Garfield : > > On Mon, Jun 7, 2021, at 2:00 PM, Larry Garfield wrote: > >> Hi folks. Me again. > >> > >> A year ago, I posted an RFC for a pipe operator, |>, aka function > >> concatenation. At the time, the main thrust of the feedback was "c= ool, > >> like, but we need partial function application first so that the sy= ntax > >> for callables isn't so crappy." > >> > >> The PFA RFC is winding down now and is looking quite good, so it's = time > >> to revisit pipes. > >> > >> https://wiki.php.net/rfc/pipe-operator-v2 > >> > >> Nothing radical has changed in the proposal since last year. I hav= e > >> updated it against the latest master. I also updated the RFC to us= e > >> more examples that assume PFA, as the result is legit much nicer. = i > >> also tested it locally with a combined partials-and-pipes branch to= > >> make sure they play nicely together, and they do. (Yay!) Assuming= PFA > >> passes I will include those tests in the pipes branch before this o= ne > >> goes to a vote. > > > > Hi again. > > > > With PFA being declined, I've again reworked the Pipes RFC. > > > > 1) It now does not use PFA in any examples, but it does use Nikita's= > > first-class-callables RFC that looks like it's going to pass easily.= > > > > 2) With major hand-holding from Levi Morrison and Joe Watkins, the > > implementation has shifted a bit. It now evaluates left-to-right, a= lways, > > whereas the previous version evaluated right-to-left. That is, inst= ead of > > $a |> $b |> $c desugaring into $c($b($a)), it now becomes effectivel= y $tmp =3D > > $a; $tmp =3D $b($tmp); $tmp =3D $c($tmp); That matters if $b or $c = are function > > calls that return a callable, as they are then only called when the = pipeline > > gets to that part of the expression. >=20 > Hi! Can you flesh out an example for this, please? Not sure I get the > use-case where it matters. Couldn't find any example inside the PR > either (the tests) that show-cased this particular implementation > detail. Did I miss it? The "evaluation order" test is for exactly that: https://github.com/php/php-src/pull/7214/files#diff-526802c5ee7e0aa37afd= 67683d2c8b73c923b445737b3b44fae6bb5ea117ee97 With the old desugaring way, _test2() was called first before anything e= lse. With the new way, it's called after _test1(), as most people would= expect from reading it. --Larry Garfield