Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127434 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 04FFA1A00BC for ; Fri, 23 May 2025 01:54:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1747965113; bh=gOikLW9nEco7UmCKxXSV19y+Ei3NR8Qk/6Z/7bUK75g=; h=Date:Subject:To:References:From:In-Reply-To:From; b=SlC9ihaNF4CzjiX9ryhbCHy7HfmQMyDhsozq+MbVI/tBUZcbE1O8QBe8ob9BUYxPp OADTIh0By2DFfpOys6n9E9eKuYUkRuRPFXXhIbWxAku7h6DXvpk6EcrDweRTbML9Re S1MJ+57LK3Vv7Hv1ree41rOW71ykC3HiJwHrgM0YcGsku/Vz63atD9bbHWhNji4bMJ xkeIOdADmcpqM5oYG39GafUbjpehvA5/TbKe1kVv70CZ/CU4sxQ7NGaVM11OsNF8ZD yXO4duHjMf8IHoYinGcOcQL8acAJrLtzAuGau040fDYrj89b0Qv+2DLa8RR/uVGkZ/ 02ZkfZjmmLO1Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9DDB01801D7 for ; Fri, 23 May 2025 01:51:52 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,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 mail-108-mta164.mxroute.com (mail-108-mta164.mxroute.com [136.175.108.164]) (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, 23 May 2025 01:51:52 +0000 (UTC) Received: from filter006.mxroute.com ([136.175.111.3] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta164.mxroute.com (ZoneMTA) with ESMTPSA id 196fad8d9bb0008631.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 23 May 2025 01:53:57 +0000 X-Zone-Loop: 2e6a32369db86b7872e19309dfc52e122689f092d322 X-Originating-IP: [136.175.111.3] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sandfox.me; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:To: Subject:MIME-Version:Date:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=G8Qz3hKBz2ryShEBMVnEIUsslsLKLMDV73pZKzlKKG4=; b=Dbt3ZwW0HMYa r+WBM3Fz7+c0JFs3W5WGFW2lLPlQeHqfHjwMTRBu8qhY45id4dCALIbx+sbpuk2mjOD5g1R9DF8Vz eWsK0IIxDyuHvXOjsuxbgWVDlWqge60AKOKspaZAEGw9tvltNYoiIvHQlXtT1xTa4RnGRgZ197n27 wXWZE2BRQiG1MhYnPfgdIHWeWpH/s/DuMKK2XJ5SLWXZLpzy+bNLSUAU3y/8r5m6elyarSWz67cFc tDblf3GAFwdhEUgRi113AerSvay/dhlKtFLGUeeN14eB717HpfPsyYJbZi51Bsqh6uJrR6jcAwUdO o82OMd439MonGwG/xV/CeA==; Message-ID: Date: Fri, 23 May 2025 04:53:54 +0300 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] RFC: Single-Expression functions To: internals@lists.php.net References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Id: sandfox@sandfox.me From: sandfox@sandfox.me (Anton Smirnov) Hi Dmitriy On 22/05/2025 12:24, Dmitry Derepko wrote: > I'm aware that Larry Garfield previously proposed a similar feature > several years ago, though it unfortunately didn't pass the voting stage. > I would like to respectfully suggest that using "=" instead of "=>" to > separate declaration and implementation might be a better approach. That looks like the weakest part of the proposition because we already have two places where inline bodies are used: the mentioned arrow functions and property hooks public string $foo { get => 'dynamic value'; } No sense in introducing a new syntax for basically just another case of inline function body. > // oneline > function handle(string $input): string = func1($input) |> func2(...) |> func3(...) |> func4(...); That looks like a callable assignment like you know $f = fn ($bar) => $this->bar + $bar; class Foo { private $bar; public function bar() = $f; } that may confuse users, another argument for => -- Anton