Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129997 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 B1E6F1A00BC for ; Tue, 3 Feb 2026 21:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1770155964; bh=6bJHN2PuD4JSleNBq+9wEF+u6xk04bmc3PtCPkC5syE=; h=Date:Subject:To:References:From:In-Reply-To:From; b=h8txcylatxW52IE4+gdi7zt8gjVde6ydkRW/wQoYn7DpRSk1RjS3zErkM+pEjDVi6 OvpQ5lW4MVGDPhL+0GofeUhSpr7sbQ6CaK9acFYYGdro/CDommVKBzpiQUTz5OAtzX HXchhjTk/hzTyROGUGabMhLFuCkjY5G0hynpcCZwj2qRxlql0GZty2gdB9zQdj5boL n/kgMEEzUbvVfrAQk1I3uvW+j/vYOqSXDpYfdzt7+qDEeI/qSVUMAvKqf9u+qII9mJ /a62Mwf7DMXu6sPURRYWJK5bywCzWAHAV4kraHkT19vVz+5xuj53vfvizOk0tA6wtv ycyGfcDmkn+8Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id AC736180086 for ; Tue, 3 Feb 2026 21:59:21 +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=0.8 required=5.0 tests=BAYES_50,DMARC_MISSING, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from franklin.smtp.mailx.hosts.net.nz (franklin.smtp.mailx.hosts.net.nz [43.245.52.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 3 Feb 2026 21:59:20 +0000 (UTC) Received: from 122-57-27-239-adsl.sparkbb.co.nz ([122.57.27.239] helo=[192.168.1.67]) by franklin.smtp.mailx.hosts.net.nz with esmtpsa authed as varteg.nz (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim 4.96) (envelope-from ) id 1vnOQP-005WxE-2Q for internals@lists.php.net; Wed, 04 Feb 2026 10:59:09 +1300 Message-ID: <36ac22c4-0166-4e5b-b18b-5f64430efb09@varteg.nz> Date: Wed, 4 Feb 2026 10:58:36 +1300 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [RFC] Pipe to return To: internals@lists.php.net References: <53c17181-caa4-41a3-b4ab-93069e6bb47b@gmail.com> Content-Language: en-GB In-Reply-To: <53c17181-caa4-41a3-b4ab-93069e6bb47b@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Hosts-DKIM-Check: none From: weedpacket@varteg.nz (Morgan) On 2026-01-31 18:52, Vadim Dvorovenko wrote: > Introducing Pipe to return RFC > > https://wiki.php.net/rfc/pipe_to_return > > In short, RFC proposes piping expression result to `return` to be used > together with pipe operator to reduce cognitive load > > "Hello World" |> strlen (...) |> return; > > -- > > Vadim Dvorovenko > I'm wondering how this would relate to the function composition operator, noted in the follow-up RFC. Basically, would "return" make sense at the end of a function composition chain, and what sense would that be? When $x |> f1(...) |> f2(...) |> f3(...); is equivalent to (f1(...) + f2(...) + f3(...))($x); [Aside: personally I find the suggested order of arguments backwards from every other instance of function composition I've encountered, but I suppose I could learn to live with it. But that's another subject.] and $c = f1(...) + f2(...) + f3(...); is equivalent to $c = fn($x) => ($x |> f1(...) |> f2(...) |> f3(...)); what happens when "f3(...)" is "return"? The intended behaviour is given for the first case but not for the others (not even the fourth, which is still the pipe operator).