Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:128186 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 700DE1A00BC for ; Tue, 22 Jul 2025 22:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1753223510; bh=SoTxTPPazSPfAAQXyEdxkDbgOe78d/WcJcb7PJR6l3o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XYOi3j9XVwQjTUpvN3gqDrNd67LlPhONmqm9JM62pM7WMTXAoobtRTU1Vhdm1fRZG Oy4h3DHtXD3Av+a8/XnbvRkeLSVHpBnyNUQoalOpL+ibJX+hQyyu3BMumt746lzPh5 7w/dyzcItDOYX2qWnkcplCqZBZskVfuPvRcvyITORzq/pxGVzJ1AQ6s4+dUytD80TU FbH59nTMRIRHeB4AlG/2ACm8NM9E1QFwBjMM6LXJcwfFEjp7sni1cThRlJhUWXWZrJ eo+Vo8CPt5rcqGk5dHaMnVUzp1R4sznYKlwjBbJMDtmGSiPQwaEPbupiCwa9wOzwso BYf4mk6A/7bAg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 29E3318003B for ; Tue, 22 Jul 2025 22:31:50 +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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS 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 chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Tue, 22 Jul 2025 22:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1753223613; bh=8/1qIQ8s5JLVo+gtGuYK65ZFN426OdTfy38cpmXM5Is=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=A3BVGX7xx4E4Jc1ONqQRIXEgJEw3dnvGdPNyKguRepflu2RS3z2nq5TmZGk+QUI9V udgas++oI0Ly01fCdzPj/Jnfi13NKzN7ksaPCWW6J7n8zekziXGWBXGWwPGrVUeFT1 GGJqYn8s2zrTigksv3gETVyr1PZs4MMxtm6vPiFLWi6o1n4dI1pyDHbBbObx0AYi+9 Iq2MAADyval04bbRpren5rv84yLuP5vj2JMPnaDpYt+GKJY6Gl4g/BuTMHlt+HPfWm SmIPCz4eYKw4AnQNUfDOiIQaGiSainQiBUlIEutFnygMHXsCpfrfQuqTCN3xAvePHf M3Sx6Qq4Yq25w== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Wed, 23 Jul 2025 00:33:33 +0200 To: Vadim Dvorovenko Cc: Ilija Tovilo , internals@lists.php.net Subject: Re: [PHP-DEV] Proposal. Pipeline assignment operator In-Reply-To: <67c4eace-0429-4ea6-ba13-7713a500b95c@gmail.com> References: <2e8a8375-62ec-4bb2-86ed-7432f389e683@gmail.com> <67c4eace-0429-4ea6-ba13-7713a500b95c@gmail.com> Message-ID: <86c508fb64fe1cb40d8d8433b54c5010@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-07-20 21:31, schrieb Vadim Dvorovenko: > In fluent we even can write foo()->bar()->baz()->assignTo($x) (as it's > user-defined method, we can make any logic). With fluent we do not need > nor pipe, nor ltr-assignment. But someone thought fluent syntax is not > good, as this is not native language operator, but a wrapper pattern, > and we have pipe operator now. FWIW: You can also define such an `assign_to()` function for use with pipes. See https://3v4l.org/R5b2f/rfc#vgit.master: function assign_to(&$var) { return function ($value) use (&$var) { $var = $value; }; } $string = "Hello World!"; $string |> strtolower(...) |> ucfirst(...) |> assign_to($result); var_dump($result); Best regards Tim Düsterhus