Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125905 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 53B3E1A00BD for ; Mon, 4 Nov 2024 13:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1730726338; bh=B0WKzlQQ2XHmGS3Q66R/Z1IBJnD68Dp2UfDaqEc53UY=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=COA4dHsPSyUOHLzcFas/hiqWworNE82Qc6Mkxyx1vrcTh4V2/XdudzjPrIaNWC/el CwPpMz1qg0AAUbjReieAIYMCJ2/HWIUeSM4Y/7TRychigehU3/1/QpoRVqsSUskXR2 5fYG+p8Tk5UEIhZwOfHXFRyYst2is92Zq3VLBdSkHrjgflNIQBJxpwoMNOgUnChL4X tQTMKL5tJfxW9HVh05IZULNb9JTG7DXaF5WnyB48UFsWI+baqyBCFSKCkU+PeB18jX 1KEgHi51JuBg424FUtbrVMVPXaK4cccVz2L+IAxRv4PiW+FF8kuz+Flo192EKxwBCo RU2+AN9K807SQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B45A9180037 for ; Mon, 4 Nov 2024 13:18:56 +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 13:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1730726183; bh=O8uaLPESKPfP1kJNioc8VkFLfWZv3jCue24CaJ+afJ4=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=MGtlHX+OicZ6rlNR91EhEsAMKHVRq+HnB8EO2XzPhP534g+pqT3KrkKp3d5lVLMvF jafcrg6gRe/7Qtn+pYyytjZtHCD/zCUkFbaQRvlBzROD+66qiBlMCb2ugNu/MQ/73i 1S+0EmJhE3SeZvgHqmJOOP4JVClIU4OtHL317ZBconnkQEcrx1K3Q5g2LqIyCKo6sJ yOt1jTZAsYNs6Oxbn6EvL29no4SlHxKcyHSDZ6M3pPBdxPHZmbTU3w8hisxn6B7Mv9 NRCBI95ZExHlwIf9Ba7x9WTF167AQFXP2Hnx03thmFWG+azsZYBJyFGhQS/5MPSOZ1 3hMjiGX9m3gaA== 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 14:16:23 +0100 To: Rob Landers Cc: Larry Garfield , 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> <219e4bbc0b94c35d2410fb640db6c477@bastelstu.be> Message-ID: <5d9af5ac1dface81bd1a9427a13b1e55@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-11-04 13:33, schrieb Rob Landers: >> What would you expect the semantics of that script to be? > > Isn't this semantically equivalent to: Perhaps? That's the question I am asking. Given that this is not a valid PHP program as of now, it would as least be debatable how this is supposed to work. It gets funnier once you want to support variables in the general case (which I consider a necessary companion to support variable capturing): class Foo { public function __construct(&$out) { $out = 'out'; } } function foo( string $bar, string $baz = new Foo($bar), ) { var_dump($bar, $baz); } To be clear: We do not intend to solve this question with this RFC. These examples are just intended to highlight the (semantic) complexities of supporting variables within const-expr. Best regards Tim Düsterhus