Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126075 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 705931A00BD for ; Wed, 27 Nov 2024 21:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1732744534; bh=Dy4WUt9uIgsd4ZnwjG7lY5ofISGdVy9mR1dvGYIsWms=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=GSymwNnSoLX386KEW/THChDAU/OIFPvxhVkpRen15kKWcBZbDh27MTH4F7n7CqDnZ iTLSqpg88e5kkWW4jdrUWRFZ3rp27hWIfkyi0plw930xhRoSwWMrLcZeo6hB9IVpv/ zQIttDbBJdyZ+Sct6AK06Ff20tLAouAwHyMUoKuq8+8h0EjWlsJ+jW+UpNMOQJ5Zyy YUVz8hfO4ODixEjtzRSGUF6coIP/R11/chZB8Ktg+wg2l92ZxZsagw7CP4rMcTZyJi irerFc4tkVOWyEmOROnQg6ZbJ0mR6c9nuif5QGeUK9iv44Z9nU+eSUk3gkFm1hQUxZ N8MdSyQ9QB0Pg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3560018007B for ; Wed, 27 Nov 2024 21:55:33 +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 ; Wed, 27 Nov 2024 21:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1732744720; bh=wBO+ebByB91jFM5n9p6VH5hBVxDKakLbl17nFQ9FufE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=cbOyINk4Rsf4sLjEWi8zPCmoWQymnXCDf+E0U/hJ+daH3CUtUJU2E+EQiMPYx5BmL lmUytcH9K+6lDup6E3Lk6oz9eTa2pBC4kfSU43pt+y2ccZdcnJwbT1iXIzl0INP/ss vf17ybL33NMQJrtKmBofciJ85Y6XDHkV5RfrSEb73YTE+2hyjQZbgN00EClBbx2S/d STj0OR9AYcrJNN4MsrPzwwNhOSYZW6qayzmzJPjCMgPa5IcehoUS6JI9Rj/pd+BgQb 18jwx/nXPelJOyYRoL1u1uSeHygTBN8XNre8z1x0nQZTBGigO6nEYkZNvQnQ0Eo7DI 5reabH1DlElTA== Message-ID: <8e0d5c13-07ae-4357-88c2-f7f9bb54f614@bastelstu.be> Date: Wed, 27 Nov 2024 22:58:39 +0100 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Subject: Re: [PHP-DEV] [VOTE] Support Closures in constant expressions To: Juliette Reinders Folmer , internals@lists.php.net Cc: volker@tideways-gmbh.com References: <6a1940027c8c534e62bfb13d222947bf@bastelstu.be> <67479414.8070302@adviesenzo.nl> Content-Language: en-US In-Reply-To: <67479414.8070302@adviesenzo.nl> 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 On 11/27/24 22:50, Juliette Reinders Folmer wrote: > One thing I'm wondering about - and of which I saw no mention in the RFC > nor in the preceding discussion - knowing that function names are > case-insensitive, how is ambiguity handled when _calling_ a callback > stored in a (class) constant ? Nothing changed about the grammar or the way a PHP program is parsed into Opcodes. As mentioned in the RFC it does not include any backwards incompatible changes, except for making some illegal PHP programs legal. In fact you are already able to store Closures in dynamic constants defined with the `define()` function (https://3v4l.org/u7ZJ1). In any case that means that all your examples are interpreted as function calls. You need parentheses around the constant name to "dereference" the value stored in the constant. This is consistent with $obj->foo() always being a method call to the foo() method, not a call to a Closure stored in a property called $foo. Best regards Tim Düsterhus