# [VOTE] [RFC] Final-by-default anonymous classes

- Thread: https://externals.io/message/122152
- Original archive: https://news-web.php.net/php.internals/122152
- Started by Daniil Gentili on 2024-01-15T10:35:58+00:00
- Messages: 8
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #122152 — Daniil Gentili — 2024-01-15T10:35:58+00:00

URL: https://externals.io/message/122152#122152

Hi all,

I've opened voting for the final-by-default anonymous classes RFC: 
https://wiki.php.net/rfc/final_by_default_anonymous_classes

Regards,

Daniil Gentili.

---

## #122153 — Nicolas Grekas — 2024-01-15T10:56:22+00:00

URL: https://externals.io/message/122152#122153 · In reply to: #122152

Hi Daniil,

I've opened voting for the final-by-default anonymous classes RFC:
> https://wiki.php.net/rfc/final_by_default_anonymous_classes
>

I voted against the proposal because as I mentioned in the previous thread
on the same topic, this is a backward compatibility break that lacks ground
but will have impact.

Note that I voted even though I think the vote itself might be "illegal"
per our policies (neither did 6 months pass, nor does the proposal make
substantial changes to the previous one, to some definition of
"substantial"). If the vote itself isn't allowed per this policy, then my
vote is void of course.
https://wiki.php.net/rfc/voting#resurrecting_rejected_proposals

Sorry for being a bit legalist on the topic but principles matter. We have
policies and this vote is on the edge of two of them. That's a red flag for
me.

Nicolas

---

## #122154 — Bob Weinand — 2024-01-15T11:21:53+00:00

URL: https://externals.io/message/122152#122154 · In reply to: #122153

> Am 15.01.2024 um 11:57 schrieb Nicolas Grekas <nicolas.grekas+php@gmail.com>:
> 
> ﻿Hi Daniil,
> 
> I've opened voting for the final-by-default anonymous classes RFC:
> > […]
> 
> I voted against the proposal because as I mentioned in the previous thread
> on the same topic, this is a backward compatibility break that lacks ground
> but will have impact.
> 
> Note that I voted even though I think the vote itself might be "illegal"
> per our policies (neither did 6 months pass, nor does the proposal make
> substantial changes to the previous one, to some definition of
> "substantial"). If the vote itself isn't allowed per this policy, then my
> vote is void of course.
> https://wiki.php.net/rfc/voting#resurrecting_rejected_proposals
> 
> Sorry for being a bit legalist on the topic but principles matter. We have
> policies and this vote is on the edge of two of them. That's a red flag for
> me.
> 
> Nicolas

Hey Nicolas,

I think having a radically different approach to this definitely qualifies as substantial.

The previous RFC made final opt-in. This RFC proposes final by default and an opt-out, which is something a lot of voters suggested.

Feel free to disagree, though I see here no grounds for disqualifying. This rule is here to not have repeated votes with cosmetic changes, to force a vote through.

Bob

---

## #122156 — Sebastian Bergmann — 2024-01-15T11:44:53+00:00

URL: https://externals.io/message/122152#122156 · In reply to: #122152

Am 15.01.2024 um 11:35 schrieb Daniil Gentili:
> I've opened voting for the final-by-default anonymous classes RFC: 
> https://wiki.php.net/rfc/final_by_default_anonymous_classes

I am confused by the voting option "Make final anonymous classes final by 
default".

You mean "Make anonymous classes final by default", right?

---

## #122161 — Nuno Maduro — 2024-01-15T12:54:37+00:00

URL: https://externals.io/message/122152#122161 · In reply to: #122152

On Mon, 15 Jan 2024 at 10:36, Daniil Gentili <daniil.gentili@gmail.com>
wrote:

> Hi all,
>
> I've opened voting for the final-by-default anonymous classes RFC:
> https://wiki.php.net/rfc/final_by_default_anonymous_classes
>
> Regards,
>
> Daniil Gentili.
>

Hi Daniil,

Thank you for your work on this RFC. In my opinion, this RFC should not
move forward for consistency reasons. If regular class definitions are
non-final by default, anonymous classes should be non-final too.

In addition, it would be a breaking change with very little benefit - like
a small optimization in the op-cache.

---

## #122162 — Ilija Tovilo — 2024-01-15T14:37:26+00:00

URL: https://externals.io/message/122152#122162 · In reply to: #122152

Hi Daniil

On Mon, Jan 15, 2024 at 11:36 AM Daniil Gentili
<daniil.gentili@gmail.com> wrote:
>
> Hi all,
>
> I've opened voting for the final-by-default anonymous classes RFC:
> https://wiki.php.net/rfc/final_by_default_anonymous_classes

It seems you've edited the text of the poll. Doing so disassociates
the existing votes from the poll, so the existing votes were gone. I
reverted the change, the votes are now back.

Ilija

---

## #122166 — Nikita Popov — 2024-01-16T21:34:19+00:00

URL: https://externals.io/message/122152#122166 · In reply to: #122161

> On Mon, 15 Jan 2024 at 10:36, Daniil Gentili <daniil.gentili@gmail.com>
> wrote:
> 
> > […]
> 
> Hi Daniil,
> 
> Thank you for your work on this RFC. In my opinion, this RFC should not
> move forward for consistency reasons. If regular class definitions are
> non-final by default, anonymous classes should be non-final too.

I don't think that consistency is a good argument here, because anonymous classes are qualitatively different in this regard. In order to extend a class you need to name it -- which *should* be impossible-by-design for an anonymous class.

Unfortunately, due to an implementation oversight, this is not actually true. I consider the fact that extending anonymous classes is possible to be a bug, which is why I also accept the minor backwards compatibility break that comes with fixing it. Of course, the line between a bug and a feature is quite fine sometimes, so I understand that people have differing views on where this falls.

Regards,
Nikita

---

## #122167 — Kamil Tekiela — 2024-01-16T21:59:53+00:00

URL: https://externals.io/message/122152#122167 · In reply to: #122166

I have voted no. Not because I disagree with the proposal, but because
I think the timeline is wrong. First, we should identify a way to
deprecate and disable the option of naming anonymous classes. I
suggest we deprecate this "feature" in PHP 8.4 and remove it in PHP
9.0, as well as making the anonymous classes final.
