Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128148 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 14ED61A00BC for ; Sun, 20 Jul 2025 19:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753039125; bh=sYrtuaXnoXoFQbWt5yvh11SMqZE9esZVZFbsNWO2g0Y=; h=Date:From:To:In-Reply-To:References:Subject:From; b=en6n7X1L7GZaxLtvTUbImRTZkOuQXX9wg1hVmgvjYeJw27MgJ5hVDkwApJ58+BRF5 h1tGCyXXIvB+HEHyXPWWpOttNeIXfgSgKwRzergO8CfTkyIiaLSbor19e0/FyDYvv9 tdjqTXogvNP5me/8i4L3cXvLOdtkEaFINYUHNcwQKVzS6ENq9KJ04lWAJmvRp6BRlg JoMgRbmsO1/raJLnVQR6LPQ1rKu/Uo9gbnWOr8ORccYCP/SX4+UlXJxASSNrR+o1C6 B7BNgO4KzCSqVozXyZkynGSXRzX5QxHLSyQke+BhBnULymcGO7nZsmmO0sx9Nn0JQ1 3TMt5iJFZ7LlQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E99D218005B for ; Sun, 20 Jul 2025 19:18:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 20 Jul 2025 19:18:44 +0000 (UTC) Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id CF0111400102 for ; Sun, 20 Jul 2025 15:20:29 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-10.internal (MEProxy); Sun, 20 Jul 2025 15:20:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1753039229; x=1753125629; bh=wK31bqLjhhUN3rbgytfJt p82ty6nCgrq9t7bAYyzhaA=; b=M7RvgRCw+zn5gSqvt3yObgaJq0wtfVZ9P+Brn aDhTybLQpxQDKGJJtXzwlhy2RJ/iiYo12qlN3AfnZtFJc0cuTDJVzFsBrkPH936s i9cIJSfp+i5dzjAQZGTlc3AOh9zuHO+DVsCZPGkjmXasPzYbKZZsxIwC9SwQ20cB 5vuF273tzxshFbNOE0EzGb6I7q1c6WSQXqe3TAm5g+mVwkauZJaEfwOuA1v6kuXR 2/yWNz2raMF6KeZmr0x3Frz93OWro+3+eLNYGVjDDAQ+/WyZsI9+wsZkHKJQykLZ PRa6HWvtXfzLg91oDV7DVNwPEIb+nR5ZfY3XcjooxExPUrQGQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1753039229; x=1753125629; bh=w K31bqLjhhUN3rbgytfJtp82ty6nCgrq9t7bAYyzhaA=; b=dYB0KGn97J1UwqT8I Nyt9gCO/cN3Ck1VTu2Wc6mhciiSVRU+hEvP2YeqWiZfMiluSukTvtyqGT8nodjzy aapVDPF3geY3lV9HHXmNMKPHU5Oktxhy2d86JPuYtqbyEQIi37CARAbqrwlB8+ZA kd77HSGi582FXTX8EEgX7/0tljKbgIIgqLvjwM59BcyhLxHKNX4hi2sCooLVI7XL 6AVOaGfgCSdj88zBkIjQxiC+aSZRZ45GkDC/2QNhlvmr8LmUKshlt1Ffl6fTeoFh yCgGxR5tmbB67ZebwSrcMOR3GbkYYkxvjaRj3TLE8ALstPFv/kFRx2WZg0HNH5TI 9avMw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdejtddtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvkfgjfhfutgfgsehtqhertdertdejnecuhfhrohhmpedfnfgrrhhrhicu ifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqne cuggftrfgrthhtvghrnhepiedtudefueehiedvgfeuteelffevhfejfffgfffgveffvdev ffekhfehudetleffnecuffhomhgrihhnpehgihhthhhusgdrtghomhdprhhftgdrmhgune cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhr hiesghgrrhhfihgvlhguthgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvg epshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhp rdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 8F005700065; Sun, 20 Jul 2025 15:20:29 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: T9a8d9754d7820279 Date: Sun, 20 Jul 2025 14:20:09 -0500 To: "php internals" Message-ID: In-Reply-To: References: <2e8a8375-62ec-4bb2-86ed-7432f389e683@gmail.com> Subject: Re: [PHP-DEV] Proposal. Pipeline assignment operator Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Sun, Jul 20, 2025, at 5:22 AM, Ilija Tovilo wrote: > Hi Vadim > > Thanks for your follow-up. > > On Sun, Jul 20, 2025 at 11:54=E2=80=AFAM Vadim Dvorovenko > wrote: >> >> Recently introduced pipeline operator is great, but together with >> assignment operator it will lead to mixing top-to-bottom and >> bottom-to-top code reading directions and vertigo. >> >> To reduce this problem i'd like to discuss the idea of left to right >> assignment operator. The draft rfc can be found here >> https://github.com/vadimonus/php-rfc-pipeline-assignment/blob/main/rf= c.md >> , there is the part, that describes problem. > > The problem you're describing is not unique to pipes. Code like this > is quite common. > > $x =3D foo() > ->bar() > ->baz(); > > If we decide this is a problem (which I fundamentally disagree with), > then we should try to find a general solution, rather than something > that is specific to pipes. There's no reason why this example > shouldn't work. > > foo() > ->bar() > ->baz() |>=3D $x; > > At that point, you should probably also look for an operator that > isn't pipe-specific. But again, I disagree with the premise that this > is a problem to begin with. > >> The current bahavior of pipe operator when used with variable is wery= poorly described in RFC > > That's not quite accurate. It states: > >> The left-hand side of the pipe may be any value or expression. > > And according to PHPs expression model, variables get no special > treatment. They are evaluated and the result is used accordingly, > pipes are not special at all in that regard. > > Cheers > Ilija I am also not a fan of this proposal for much the same reason. First, the mental model it proposes I do not agree with. The model of=20 =3D is fairly universal in PHP and in most languages. It's quite self evide= nt at this point. =20 Furthermore, there are plenty of other "read down and up" use cases beyo= nd pipe. match() and ternaries come to mind as common examples. The behavior of pipes with variables is also very well defined. The lef= t side is any expression (including a variable). The right side is a ca= llable. That callable could be a variable that references a Closure, an= d often will be. So it's already quite clear what will happen If we were to agree that there was a use case for "reverse assignment" (= of which I am not yet convinced), it should be its own stand-alone thing= . Just for argument's sake (not actually proposing this): =3D=3D> That would then work at the end of a pipe chain, a match statement, a te= rnary, or whatever else you felt like. Self-contained parts that play w= ell with others are almost always superior to a one-off solution. --Larry Garfield