Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126323 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 EE5821A00BC for ; Fri, 7 Feb 2025 08:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1738915946; bh=PidcYtw9Ln4/kzwQ8dJcxchlMK/ZJC0ncIKz0qzp9ZU=; h=Date:From:To:In-Reply-To:References:Subject:From; b=S/1ehOLVA6pxKlFv/vGc+0o7lnt00JNoDowFTtMZFCxct6/shuTycupfuJGuCqAq2 YvGb3hWClsXcBwusaMfeuI5L8qbDvhzzvbf2LW/7G0EOiPMK8t361aZbLoC70ZztXK 84cbrpAzZx9YgaHcr7WuJ0iWvnOc0IcZroO9XxK4ChdP/JNXd5OwW8Zl7UAES0WYv6 OFxUGDfZK+o6FOdW/vPmRtbKt4B3dCXAuXFfiNHam/WZo9JTjAmGN1kP6fJ/7Lka5q kgRGz1d/+EeR+9v/01GEi73WmtG1B5qv2sYrJCjPxdBjNsJBJN/UjoXbHVwTJ75pqK 5woDRkmCEyJwA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2B77F180593 for ; Fri, 7 Feb 2025 08:12:25 +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=-0.9 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fout-a5-smtp.messagingengine.com (fout-a5-smtp.messagingengine.com [103.168.172.148]) (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 ; Fri, 7 Feb 2025 08:12:24 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id 43DB713802FA for ; Fri, 7 Feb 2025 03:15:09 -0500 (EST) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-01.internal (MEProxy); Fri, 07 Feb 2025 03:15:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc: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=1738916109; x=1739002509; bh=tth8BDfokl rMCbxIvHNLa/1VBnrOzMTOS8tYjDmTDg8=; b=XXvy6HdD/oEAOtXkTWXmrpUjDK Cr5XadFu4sO5mhALwwvdb/5vimUv2wnuQsV1z5TjOTfoGKj7tsuwBXvhQxmnEbcZ OdvJjLRWI17KBopw94kcB6zoPxCU81jJlW7C2AVQA2OeiIjE9QXMbxzItotXLmdU KP9IpiRn7FoZ9YXSvozgfCXcRR3ehU2kkvrBWFQQ3V0GyJRP5AAJ0WEj7Yu9aSK2 TNf7+lQ7SXA8bvbMx2XX2iQ5Plhvo+dzGs0M3szWku5kItqhm1ff/nPS4/fc4tPI WP8al/dN0RM7+GwnSnLKpNquWxEEu9OtcivbZINWNJPjAwkOxRi6eD6LMGOg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm3; t= 1738916109; x=1739002509; bh=tth8BDfoklrMCbxIvHNLa/1VBnrOzMTOS8t YjDmTDg8=; b=GPWg1CfIcvrYOgBVXWhW6ts6C4KqGSXLdbzd5GoCvPbRcBHLg7o tUUttQ59tBuoQroajdIo++eUMi4ytA2eNuEBiiAePo4gebzHvvrl3j3zyjZycuPb YXugSoyUXadjjrwZapAZbWkCRpdZcdie2MyaMQimxFn+NQtAt/C9CyAviD45J8iP YcHcCxW3PhIXRvg5g98nnL42NnehCz4bMqqxpPXrW6smHLB/54QEK4Xkae8LnmPO xSQFofOsR8bTgRbvB0Fs/HAQQCn4R5zy9R71X3Y2TIqxh5GBXi8dF7HZuU0nM21V y1wK4Nwhja023BVvC25bKP9L7Kuaw47Ij3A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvkeejjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepofggff fhvffkjghfufgtsegrtderreertdejnecuhfhrohhmpedftfhosgcunfgrnhguvghrshdf uceorhhosgessghothhtlhgvugdrtghouggvsheqnecuggftrfgrthhtvghrnhepleekhe dtgfefhfelieelgfegiefhkedvleefjedtffelhfehheffgfduteduuddtnecuffhomhgr ihhnpehphhhprdhnvghtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprhhosgessghothhtlhgvugdrtghouggvshdpnhgspghrtghpthhtohep uddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhish htshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 7F2FF780068; Fri, 7 Feb 2025 03:15:08 -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: Fri, 07 Feb 2025 09:14:47 +0100 To: internals@lists.php.net Message-ID: <6f3bed6d-a537-456d-b90c-b5b864835998@app.fastmail.com> In-Reply-To: References: Subject: Re: [PHP-DEV] [RFC] Pipe Operator (again) Content-Type: multipart/alternative; boundary=4ed7bc629e9140d68133df679193c935 From: rob@bottled.codes ("Rob Landers") --4ed7bc629e9140d68133df679193c935 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, Feb 7, 2025, at 05:57, Larry Garfield wrote: > Hi folks. A few years ago I posted an RFC for a pipe operator, as see= n in many other languages. At the time it didn't pass, in no small part= because the implementation was a bit shaky and it was right before free= ze. Nonetheless, there are now even more (bad) user-space implementatio= ns in the wild, as it gets brought up frequently in "what do you want in= PHP?" threads (though nowhere near generics or better async, of course)= , so it seems clear there is demand in the market for it. >=20 > It is now back with a better implementation (many thanks to Ilija for = his help and guidance in that), and it's nowhere close to freeze, so her= e we go again: >=20 > https://wiki.php.net/rfc/pipe-operator-v3 >=20 > Of particular note, since the last RFC I have concluded that a compose= operator is a necessary complement to a pipe operator. However, it's a= lso going to be notably more work, and the two operators don't actually = interact at all at the code level, so since people keep saying "Small RF= Cs!", here's a small RFC. :-) >=20 > --=20 > Larry Garfield > larry@garfieldtech.com >=20 Hey Larry, Maybe I missed it, but what happens here? [1,2] |> add(=E2=80=A6) Is the array deconstructed or passed as-is? Further, if it is passed as-= is (my gut is telling me it will be), then what is the error? Is it the = normal =E2=80=9Cmissing second parameter when calling add()=E2=80=9D err= or or a new error specific to pipes? If it is passed as-is, would the following be legal? =E2=80=A6[1,2] |> add(=E2=80=A6) =E2=80=94 Rob --4ed7bc629e9140d68133df679193c935 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

=
On Fri, Feb 7, 2025, at 05:57, Larry Garfield wrote:
<= /div>
Hi folks. = A few years ago I posted an RFC for a pipe operator, as seen in many ot= her languages.  At the time it didn't pass, in no small part becaus= e the implementation was a bit shaky and it was right before freeze.&nbs= p; Nonetheless, there are now even more (bad) user-space implementations= in the wild, as it gets brought up frequently in "what do you want in P= HP?" threads (though nowhere near generics or better async, of course), = so it seems clear there is demand in the market for it.
It is now back with a better implementation (many thanks to= Ilija for his help and guidance in that), and it's nowhere close to fre= eze, so here we go again:


Of particular note, since the la= st RFC I have concluded that a compose operator is a necessary complemen= t to a pipe operator.  However, it's also going to be notably more = work, and the two operators don't actually interact at all at the code l= evel, so since people keep saying "Small RFCs!", here's a small RFC. :-)=

-- 
  Larry Garfie= ld


=
Hey Larry,

Maybe I missed it, bu= t what happens here?

[1,2] |> add(=E2=80= =A6)

Is the array deconstructed or passed a= s-is? Further, if it is passed as-is (my gut is telling me it will be), = then what is the error? Is it the normal =E2=80=9Cmissing second paramet= er when calling add()=E2=80=9D error or a new error specific to pipes?

If it is passed as-is, would the following be le= gal?

=E2=80=A6[1,2] |> add(=E2=80=A6)

=E2=80=94 Rob
--4ed7bc629e9140d68133df679193c935--