Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125901 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 4D3981A00BD for ; Mon, 4 Nov 2024 12:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1730722167; bh=vnZweeSySJKLbe2wJafdbeaqXWHjoG37MhN+ufO4ZHo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=WeKB226tLtVvJKFidjgp6VoxzNTMfdEqBEvBFryR8PrwXHGZcLw0ALCQINcuEr2EG 5Q8G5afmsSw5g5eleO+7DuABRbjpoSyDe8NZiNSywZ4NVzqdJx/3AhOfrbE3iF+LkP wAMdlELPWKfkSLORGvPKhjykGjbDfmDpPjWxmMR0aLZyqlnAipsTlzE6/19R8cEIbI DVQxaUFEmBgv5jR6o/4pJ2N1pw60CwS/Hvi0ZS6EPofAMfZqagBUx8AVViZLeNtVoM mBssmdtSzmQZ6a1rxpaT+nhX8tbL0sxBhj7vtv3yvwCMpAowOhq1tYM1Pu0jeY0JJ5 L0oa5CpCWE3nQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A6405180004 for ; Mon, 4 Nov 2024 12:09:26 +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.6 required=5.0 tests=BAYES_50,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.0 X-Spam-Virus: No 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 ; Mon, 4 Nov 2024 12:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1730722014; bh=vg1t6fOydLYxECmuRneGGIdH0wn9Mm7WFN651E2T9Oo=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=X3GMf9a9SEsfstBLzZaXOCne7Y+s8ms51myENzgoytnUsQ0IKKIgw8UcUtD4xvJwj 9+h4XYn2g/l/T220PkC0T02l8rcfSlH4Nx4KZO+eHxVQeTAIwh7XjiCgLxHQyUohoD /UagQkzGVICBxhtE00odX2gQozG2LZ5CwMZb66nWUxtWMf8BEwXZ6w9i/B1elJ7eeZ k72iuvUjutMYl1FYzvbH3ct5JaoFvWaDyrUbHPwfqVxY3DpZMbooq+E81ovIioZK6U CEQkbozHqm6csSH455V7vkQWtCmDLH0pD1uaGtjPRG/PtGc+WiaJ+UstS0tCfWQBsI EoNDvhdkh2tww== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Mon, 04 Nov 2024 13:06:53 +0100 To: Larry Garfield Cc: php internals Subject: Re: [PHP-DEV] RFC: Support Closures in constant expressions In-Reply-To: References: <15da4c13445d7e9c9d768c60c19768d4@bastelstu.be> <3b458165-406c-4b70-97bc-6e98d6c44c72@app.fastmail.com> <6f39dce9e6b0579baa51bc84cb8140b9@bastelstu.be> Message-ID: <219e4bbc0b94c35d2410fb640db6c477@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 2024-10-31 07:16, schrieb Larry Garfield: > Hm. It would never occur to me to use a function for a non-class > constant in the first place, so I don't know. :-) Frankly I can't > recall the last time I used a non-class constant period. :-) > > That said, PHP consts are already a bit squishy, and auto-capture is > always by value. That wouldn't give us a loophole? Here's another brainteaser: function foo( string $bar, Closure $baz = static fn () => $bar, ) { var_dump($baz()); } foo('captured'); What would you expect the semantics of that script to be? > If it cannot reasonably be done now, but is possible, that should be > listed in future scope with roughly what it would take for a follow-up > to do. (And then we can argue if it should just be done now, with more > information as to how much work that is.) I have added an entry to the “Future Scope” section. See also my reply to Alex. Best regards Tim Düsterhus