Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126097 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 296FB1A00BD for ; Mon, 2 Dec 2024 22:48:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1733179535; bh=NxwWy5tRc6qgBD+MCXk1Vs+Rp5n5zyha47JE3XYqhI0=; h=Date:Subject:To:References:From:In-Reply-To:From; b=JXcusSqz6LAXvyqCnTgUiDdXp5si4yT1zbf3tqgjXGpYM5nmthPL2tdC+nic2Boe7 EDWC1IaxgZ2u2qroOw6dRbml3UrBfopsxHPO2SWd86Jb0ztnAtd5DuYHpxHPyB40Xi dWjMwZmjhJqqTgj1HAuAMyxo7Lc8ysCiRSL6uJm+6Ik3Yhn8r4zRi9Ha4+HEIpEvYN V4Q9+a52iqRCz8cb/6UcMHNfQ0cm9OS/ItQgdqAohsbF4Az/AIYGW5PGH195E9okVp V775sOWQlLz1RpmsRlDshHP8XN1z3xdCeIwkGSJ94XUanOXu3GUiuRhD0icUejFcRD GqPkA/vptnA3Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 973A818002F for ; Mon, 2 Dec 2024 22:45:34 +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, 2 Dec 2024 22:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1733179720; bh=6rdL0uaKlQVd2FSeWX7CBbthRJAYgcXxws3xxm3RGOY=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=mKBS4FGUg8uQxmLClRARfRcu+5OzMNSDPcFQiae1P1QmFW7IVYw32ZYBueRl3lgOm hg1RB24BIuckWJPIhcNl2HIFBxMNupz0PMvVvFTeYDxgObO3fY3sIs9TzpduvxHqNa xv0O0In7aCYlwt43rr7eLHS87iSfRBGz3jiJx6r4AY/M4nxByscBEsrHEaRCnYTGGA yz5OxS5LvzVBpNJ/+eUIlpfuyw56AYzby1OV3/sHKeaQkuMl8vNsW9to3hCOUwjKK/ lgcmW/7xtPxMVqw0dE6SitzSTbZqQ6697m64kFMfOWImy9F0oxzqbjsYnm9D4RQJmq UB5jFETsBOKlg== Message-ID: <175e84d9-5568-413b-ab1c-57d8959adf06@bastelstu.be> Date: Mon, 2 Dec 2024 23:48:38 +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] [RFC] [Discussion] Attributes on compile-time constants To: Daniel Scherzer , internals@lists.php.net References: Content-Language: en-US In-Reply-To: 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/30/24 18:00, Daniel Scherzer wrote: > Based on feedback to my last thread[1] that an RFC would be needed to allow > attributes on constants, I have just filed > https://wiki.php.net/rfc/attributes-on-constants and added it to the "Under > Discussion" section on the main RFC page. Thank you for your RFC. As you might have guessed from my comments on the PR, I quite like the proposal to round off attributes. Nevertheless any new syntax has quite a bit of an impact on tooling around PHP (see also (3) below), so I'm curious if you already have any use cases besides the `#[\Deprecated]` attribute that could be mentioned in the RFC text? ----------- Other than that, I have the following remarks to the RFC itself: 1. ”New constant Attribute::TARGET_CONSTANT may conflict with subclasses that define such a constant of their own.” This is a non-issue, because the Attribute class is final. 2. ”Extensions that validate the usage of their attributes and use Attribute::TARGET_ALL may need to be updated.” This is not just extensions, but also userland code that did not anticipate any new attribute targets. 3. The “Backward Incompatible Changes” section should probably shortly mention that this is new syntax and will need changes to IDEs, static analysis tools and formatters. The second paragraph in https://wiki.php.net/rfc/closures_in_const_expr#backward_incompatible_changes might be a good example. Best regards Tim Düsterhus