Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125899 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 C1A081A00BD for ; Mon, 4 Nov 2024 11:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1730721442; bh=Z/Vt/hY7AuayUWvC8D6KOo1Zur//qSOoeRgB6QFOPrg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DcZUaYtRYOVf8Hy1dvhw6iqf7wc/6t6kQfROxtz+Uweuo3s8QrmFMrVv9xVk1MW/6 Bz5ZPMQEyidZZeL4UvI4a2v4shN3rB7smcXMRTwAy7IRYZs3c6yG6d+I4O+NZgjuX9 5nc6SwjRVKQvcH/D89CeymyuhvM6UaLBWRoNUCbcJj672/iIgOdwEz1OICU2F219qT hdjvQCq2Z8qyDEOnF47giyT1JG1awYgonjdbGVPFfZLHaPZcw+46XhoaKV5DdRuFCa rfXQImu1XYi9LKhtBrPVvuu14zSb41d+2n4ng5Smu8z+Jz3qGiMmkQNoRjbocxsP/X UFbggDkh5woRA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EB2A9180037 for ; Mon, 4 Nov 2024 11:57:21 +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 11:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1730721289; bh=nea4EjW0F4ZMRgaOKSciEsfQZ3Ob7iEgBSPQWPdftWs=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=pEAu4/eCvaYU9mRHDZPggAJecY7ktMsMZcbMwhwEH/bUh78loME59qZlyR89ePoFP wgfH2SrUJ4rjmlORhIM3GJ18kY7nACezOX/ftSKf+IGY+AiorO0oid80XzVMqklFVN 1h86nzkqdHylek9bshmyyrUmbnQBt3HhwfB4ezFmq5y7+9ne5pgpfBs7hujj1MX7hS sDQJLm1YIoO9GS3aycXodzEUmwB9ZjHdYD6oLPU3+f5flWjf5rTev1RDC9vL2Ih8ll t89W5C6TPhiImMXPFQk4l5289BVJs1csJsBjjPUTYcKFrtPCpY5FqHSeCkCRWD/m09 DFMi9GSRBY0zA== 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 12:54:49 +0100 To: =?UTF-8?Q?Alexandru_P=C4=83tr=C4=83nescu?= 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> Message-ID: 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-30 09:31, schrieb Alexandru Pătrănescu: > So, why not allow capturing, since anyway the only place to capture are > constants and static variables? Static variables already support arbitrary expressions since https://wiki.php.net/rfc/arbitrary_static_variable_initializers. The RFC initially mentioned static variables as a place where only const-expr would be accepted, but I removed that once I remembered about that other RFC. > And this way we could have short closures with auto-capture. > If there are some technical reasons for not doing that, can we have > written > in the RFC? As stated in the RFC: This constraint is consistent with not supporting variables in constant expressions. Capturing a variable is effectively the same as reading a variable. It makes no sense to support one, but not the other. Best regards Tim Düsterhus