Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126098 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 EDD971A00BD for ; Tue, 3 Dec 2024 14:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1733236693; bh=FzJNNDMTbX98ASf5vL50vo9K2j6TymtPs7Nwd+NPHVo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=PhRZS17l3nITE6CslKC73BRxg+LExm4hfkFNF3fPu4iCdMIG85Nkm7O0qN1swcbom M+p9gKwbvvrCIW+19MMgWNmT5G9ZPO63tXP8fhZi6nnV14jioZJon1YD67VMCJGrzH xlz1lAJUj6wotJj+fRrw5jaA6LhKS6Rk0G0JnrTRN1I30CkLDYjMzQUM2UL9LZ6oKM qZgYrfiZOeE2V2VO+ZvrrY+kpJWvuLv3DqllxTtqQReIeyZxRpOA7vcIMnfuIDUZiP dfQyoIz+h+6WoYx1aGNjRt4IR+1eyGFE0hiKYprGcZ57ZkaDr4+uS5KJNOAfW1zfNl iiQiqi5aomkNQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9AF9318007E for ; Tue, 3 Dec 2024 14:38:12 +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,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-vk1-f172.google.com (mail-vk1-f172.google.com [209.85.221.172]) (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 ; Tue, 3 Dec 2024 14:38:12 +0000 (UTC) Received: by mail-vk1-f172.google.com with SMTP id 71dfb90a1353d-515d0e09ab4so6678e0c.2 for ; Tue, 03 Dec 2024 06:41:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733236879; x=1733841679; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=FzJNNDMTbX98ASf5vL50vo9K2j6TymtPs7Nwd+NPHVo=; b=BWk/XVdU7EutxDvv8yRl9wBnh9kGvOvQU52wpMumBq4c8243BohGL7u4pdIyE/1maV jPLUphjDbiBu8rxBH2eS5gEKc4WxvLGT/TnwGKAiT7Eq0xbRy1GHJLp1z2m5bWaAPAnf g0fWSmbusjX3q6CopAcZbM1nwO2vDm14QiWuv/WlL67k3C9p0zNa8OCOVXZf7Q4uFl93 aj5NNv865gubUHcUErZMN/QBdbQ5jzjbXzoEUL7gxV25nxGi68Whh6xQ0OCgLz/0HpFu wuYFD5RT2aiN9I6l6bNIF6pEQRmdRz2zvdOBo+1xdpn/NX/cMkBkzP4TRzHHN8aZ0xyy 2Ebg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733236879; x=1733841679; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=FzJNNDMTbX98ASf5vL50vo9K2j6TymtPs7Nwd+NPHVo=; b=AsrMDTkrv9ptIN3iPtMGs2L44wzGkpmicleiW+A6MgwAcFUT/JpigjZNVJkVcS2mlR d0OhqoW4RNs4wRcTkjma/bYekiCzGGm5mm5Z96EoIO2YhKYva3ltza6tim+3uINNMPJ2 +z6oRlGfOQBXTPIUoAawkuR3aifzCdcLkGxCXjbm61pDZiMC2fst1Mn4CG5t+Xh1TEdX i/axVfdeyNlAMAB1W87OtxPjEa6s6dX8k+BuJJV+HPCOZ1ZGRhjPxVpyNLh6lM1UM+Yn jMrZqd3RMkNSbw7TtX2OnvOb2VGXM7EDelaAMIV/TfK6lQwZuLBMK14bhKnyBsByuHMH WP3A== X-Gm-Message-State: AOJu0Yya/GV8z7VSzXN5VLARpKYBWf8JZLxW0mnvVvwCrQfYxmyNxKCW C/CHZ8HiqVn84c3t/mRWGHkBpXiYzbvhYNXj1PKwzfOoB6eAQ9meutJJKSqbZaxIsGPSzBYjPIL r4MYR26snk+wSOlaHjMLFzTwL6ePd9OpX X-Gm-Gg: ASbGncvvr0/p5QgkrQAyecJnKEU5OcKtvKhRmm3emsWrLTtCve4vJaXHZYEimmK78Lq 7CUIny5i15FppoLoQ6eabrQX7h14yv0bUUy0oBYMQoNb0xtJ+DTtfYKSSPh/Ugf8= X-Google-Smtp-Source: AGHT+IEhCzd5DISSFuMF6q3cidjGpzJ5BUdXtTHzeH0S8i/DkMAMeXlN7nd1OHB5q1TKhuErZ3kHq6D8WKoT+kWA74w= X-Received: by 2002:a05:6122:201b:b0:50d:7a14:ddf7 with SMTP id 71dfb90a1353d-515bf52d7d8mr3374521e0c.8.1733236879262; Tue, 03 Dec 2024 06:41:19 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <175e84d9-5568-413b-ab1c-57d8959adf06@bastelstu.be> In-Reply-To: <175e84d9-5568-413b-ab1c-57d8959adf06@bastelstu.be> Date: Tue, 3 Dec 2024 06:40:42 -0800 Message-ID: Subject: Re: [PHP-DEV] [RFC] [Discussion] Attributes on compile-time constants To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000800c8c06285ea887" From: daniel.e.scherzer@gmail.com (Daniel Scherzer) --000000000000800c8c06285ea887 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Dec 2, 2024 at 2:48=E2=80=AFPM Tim D=C3=BCsterhus wrote: > 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? > I don't have any other use cases at the moment - my primary motivation in writing this feature was to allow deprecating constants. A few weeks ago I gave a talk[1] where, among other things, I talked about how I was looking forward to using the #[Deprecated] attribute, but that there was still room for improvement since it could not be used on non-class constants. I then figured: why not try to implement that support myself? And I eventually figured it out. > This is a non-issue, because the Attribute class is final. > Fixed, thanks > This is not just extensions, but also userland code that did not > anticipate any new attribute targets. > Given that 1. there isn't (as far as I know) a way to search for everything that has an attribute 2. there isn't a current way to identify if a constant has an attribute I didn't think there was anything to actually break for userland attributes, but I've reworded the note to include userland attributes just in case. The =E2=80=9CBackward Incompatible Changes=E2=80=9D 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_cha= nges > might be a good example. > Done -Daniel [1] https://youtu.be/hGYbXkfbkuU --000000000000800c8c06285ea887 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Dec 2, 2024 at 2:48=E2=80=AFPM Tim D=C3=BCste= rhus <tim@bastelstu.be> wrote= :
=C2=A0
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?

I don't have any other us= e cases at the moment - my primary motivation in writing this feature was t= o allow deprecating constants. A few weeks ago I gave a talk[1] where, amon= g other things, I talked about how I was looking forward to using the #[Dep= recated] attribute, but that there was still room for improvement since it = could not be used on non-class constants. I then figured: why not try to im= plement that support myself? And I eventually figured it out.
=C2= =A0
This is a non-is= sue, because the Attribute class is final.

<= div>Fixed, thanks=C2=A0
=C2=A0
This is not just extensions, but also userland code th= at did not
anticipate any new attribute targets.

G= iven that
1. there isn't (as far as I know) a way to search f= or everything that has an attribute
2. there isn't a current = way to identify if a constant has an attribute

I d= idn't think there was anything to actually break for userland attribute= s, but I've reworded the note to include userland attributes just in ca= se.=C2=A0

The =E2=80=9CBackward Incompatible Changes=E2=80=9D 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/rf= c/closures_in_const_expr#backward_incompatible_changes
might be a good example.

Done

-Daniel

<= /div> --000000000000800c8c06285ea887--