Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126510 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 qa.php.net (Postfix) with ESMTPS id A7E371A00BC for ; Wed, 26 Feb 2025 06:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1740551054; bh=MXFweniBSA4JBqx5XtkkxRZsuCpovYlYZZmdbKiXWyw=; h=Date:From:To:In-Reply-To:References:Subject:From; b=S29nKefI7dkmVNLGp4PbRvVmsXl7PIO2ekG6H8DlzIeYsO+Nd457UHFsiIAAMZLV+ wY3sUirkLjC6JVcByRYYOhJnl9UiS8cVx2iL4e9/7l46ntf1v6yQYIoMMMevV60Amg I9T8g0tiK7MwEy4G0dAZIQBQLll4Vu+Wka/aXd7w/pC5hNKIDFb9paSqg5VfG3sVFY 2RUkhhYXnMv59RxUAShq4GvzQiTL+hKpl77i4PpWBKjW+CUj6pqmIVAjGiyUPdK098 C9JuFOMxhUvVfj08QRrR260zx8wbHm/JBLkdOdQ5eXrH34rRNT+TYduUOrucF0eRoX c9Tz90h/4UXxQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 49B7E180086 for ; Wed, 26 Feb 2025 06:24:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) 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.0 X-Spam-Virus: No 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) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 26 Feb 2025 06:24:10 +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 994D11140114 for ; Wed, 26 Feb 2025 01:26:48 -0500 (EST) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-10.internal (MEProxy); Wed, 26 Feb 2025 01:26:48 -0500 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=fm1; t=1740551208; x=1740637608; bh=svNrUutpPW+mf+DBb5NeM y3A5fRgpX1MHRhnUgYYqgs=; b=h7dYDxg77/oAh6AuBTk8nZ/pfYNJLZU11H1Ks Uzt81qqSLRXGWw1kVq5TJGG3oKgO63ZiEKJaoPnWV/xXMH/ksJ+1g/4rViJb7447 Ee2vBvJqWBZ8oY8ueredQrM4+LCu34NtvqW8n3RbcyiLVVo3u5r0hW0eXQ2AVh0x DyL6c3p5DJHZfNgYRNUMClxWF02pf/VYu4qiEGyy2T+icuIg8VhWIPlLhA8+XcWN lRkThyN6EAZkaaN8sJdNQqPby4pu9f51Gq4y9hhWGEMHzEGb/iypwIo+bmdVL3xF g+RXTrrKEjpCTJyCk8xAKYG+2icevGHOW/PWf1v7Lh7GL7TLw== 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=fm1; t=1740551208; x=1740637608; bh=s vNrUutpPW+mf+DBb5NeMy3A5fRgpX1MHRhnUgYYqgs=; b=L3LWysxDHhulYshbR nSiwsPcIpmtO8WcgAgHNe7KdmmN/ciHTxi+nGZ7YNK2InZMQ3o6GRAl4fSlrEd9t hOIwbTfMvB3k+G81utxuocWQ1cYpGaPU9QUlRZM8rZH53L55On0U5HpYpyzBlGw6 cAkya6j2hljZhLuw0eiRbElOipsXfjLOukJFy11JTm/IkqyUtVRFIQXLFKLB7FaZ pctQDYryrMjriEBELYM1ZgYJOEoRMihLcIn1BzaGVLKjqDXrp9gkfcViC0Pyh3C+ 5Ckn7O95+XYjHHKhPbCnI7mssDWwL3NuPJX5aW4h3gIvrw9RMfSLTNTWsdJKi8f9 JXaSw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdekfeekhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefoggffhffvkfgjfhfutgfgsehtqhertdertdej necuhfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfh hivghlughtvggthhdrtghomheqnecuggftrfgrthhtvghrnhepuefgteeijeeuveffudel hffhtefhkeevtdeuvefgffdvfeeivdetgfehveetleffnecuffhomhgrihhnpehphhhprd hnvghtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep lhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupd hmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhs rdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 075AA29C006F; Wed, 26 Feb 2025 01:26:48 -0500 (EST) 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 Date: Wed, 26 Feb 2025 00:26:27 -0600 To: "php internals" Message-ID: <5d8e68bd-a46c-4696-9a19-6daf7323efa0@app.fastmail.com> In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] Pipe Operator (again) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Mon, Feb 10, 2025, at 4:04 AM, Tim D=C3=BCsterhus wrote: > Hi > > Am 2025-02-07 05:57, schrieb Larry Garfield: >> https://wiki.php.net/rfc/pipe-operator-v3 > > After also having taken a look at the implementation and then the=20 > updated =E2=80=9CPrecedence=E2=80=9D section, I'd like to argue in fav= or of moving `|>`=20 > to have a higher precedence than the comparison operators (i.e. betwee= n=20 > string concatenation and `<`). This would mean that `|>` has higher=20 > precedence than `??`, but looking at the following examples, that=20 > appears to be the more useful default anyways. > > I'm rather interested in handling a `null` pipe result: > > $user =3D $request->get('id') > |> $database->fetchUser(...) > ?? new GuestUser(); > > Than handling a null callback (using the RFC example, because I can't=20 > even think of a real-world use-case): > > $res1 =3D 5 > |> $null_func ?? defaultFunc(...); > > To give some more examples of what would be possible without parenthes= es=20 > then: > > $containsNotOnlyZero =3D $someString > |> fn ($str) =3D> str_replace('0', '', $str) > |> strlen(...) > > 0; > > Which is not particularly pretty, but appears to be more useful than=20 > either passing a boolean into a single-argument function or piping int= o=20 > a boolean (which would error). > > Best regards > Tim D=C3=BCsterhus I have updated the patch and RFC accordingly. I think you're right, it = does make a bit more sense this way. --Larry Garfield