[VOTE] [RFC] Final anonymous classes

php.internals

Daniil Gentili

2 years ago
Hi all, I've just opened voting for the final anonymous classes RFC @ https://wiki.php.net/rfc/final_anonymous_classes. Voting started now, and will run until December 18th 2023, 00:00 GMT. Regards, Daniil Gentili.

Nikita Popov

2 years ago
On Sun, Dec 3, 2023, at 11:40, Daniil Gentili wrote:
> Hi all, > > I've just opened voting for the final anonymous classes RFC @ > https://wiki.php.net/rfc/final_anonymous_classes. > > Voting started now, and will run until December 18th 2023, 00:00 GMT.
For the record, I've voted against this proposal because I believe it should have gone with option 2, that is to *always* make anonymous classes final. It makes very little sense to me that everyone needs to explicitly mark their anonymous classes as final just because there is a class_alias loophole that could, in theory, have been used to extend anonymous classes in the past. Especially given that there is no evidence of this "feature" being used in the wild (or if there is such evidence, it was not presented in the proposal). Regards, Nikita

Daniil Gentili

2 years ago
Hi Nikita,
> For the record, I've voted against this proposal because I believe it > should have gone with option 2, that is to *always* make anonymous > classes final. > > It makes very little sense to me that everyone needs to explicitly > mark their anonymous classes as final just because there is a > class_alias loophole that could, in theory, have been used to extend > anonymous classes in the past. Especially given that there is no > evidence of this "feature" being used in the wild (or if there is such > evidence, it was not presented in the proposal). >
Should I amend the RFC, recreating the current poll with three mutually exclusive options (final anonymous classes, final by default without open, final by default with open) instead of just Yes/No (I personally share your PoV, but given the minor pushback received in the last discussion thread I initially decided against it), could that be done without restarting the discussion process? Regards, Daniil Gentili.

Nicolas Grekas

2 years ago
Hello Nikita,
> > I've just opened voting for the final anonymous classes RFC @ > > https://wiki.php.net/rfc/final_anonymous_classes. > > > > Voting started now, and will run until December 18th 2023, 00:00 GMT. > > For the record, I've voted against this proposal because I believe it > should have gone with option 2, that is to *always* make anonymous classes > final. > > It makes very little sense to me that everyone needs to explicitly mark > their anonymous classes as final just because there is a class_alias > loophole that could, in theory, have been used to extend anonymous classes > in the past. Especially given that there is no evidence of this "feature" > being used in the wild (or if there is such evidence, it was not presented > in the proposal). >
You might have missed my message in the discussion thread, see https://externals.io/message/121685#121690 There is such evidence (not in the RFC though). Nicolas

Nikita Popov

2 years ago
On Sun, Dec 3, 2023, at 16:05, Nicolas Grekas wrote:
> Hello Nikita, > >> > I've just opened voting for the final anonymous classes RFC @ >> > https://wiki.php.net/rfc/final_anonymous_classes. >> > >> > Voting started now, and will run until December 18th 2023, 00:00 GMT. >> >> For the record, I've voted against this proposal because I believe it should have gone with option 2, that is to *always* make anonymous classes final. >> >> It makes very little sense to me that everyone needs to explicitly mark their anonymous classes as final just because there is a class_alias loophole that could, in theory, have been used to extend anonymous classes in the past. Especially given that there is no evidence of this "feature" being used in the wild (or if there is such evidence, it was not presented in the proposal). > > You might have missed my message in the discussion thread, > > see https://externals.io/message/121685#121690 > > There is such evidence (not in the RFC though).
Thanks, I did indeed miss this. However, I also don't think that a test-only use is particularly compelling. If this were something that Symfony had exposed as a public API promise, we might be caught between a rock and a hard place, but this thankfully doesn't seem to be the case. I think I can fairly confidently say that the ability to extend anonymous classes by abusing class_alias is a bug in the original implementation, rather than an intentional feature. Yes, people do start to depend on bugs if they exist for long enough, but I don't think this means we shouldn't fix them (within the bounds of pragmatism). Regards, Nikita

Derick Rethans

2 years ago
On 3 December 2023 14:49:12 GMT, Nikita Popov <nikita.ppv@gmail.com> wrote:
>On Sun, Dec 3, 2023, at 11:40, Daniil Gentili wrote: >> Hi all, >> >> I've just opened voting for the final anonymous classes RFC @ >> https://wiki.php.net/rfc/final_anonymous_classes. >> >> Voting started now, and will run until December 18th 2023, 00:00 GMT. > >For the record, I've voted against this proposal because I believe it should have gone with option 2, that is to *always* make anonymous classes final. > >It makes very little sense to me that everyone needs to explicitly mark their anonymous classes as final just because there is a class_alias loophole that could, in theory, have been used to extend anonymous classes in the past. Especially given that there is no evidence of this "feature" being used in the wild (or if there is such evidence, it was not presented in the proposal). > >Regards, >Nikita
I agree with this, and would also say that this RFC is the most thin one I've seen. There is no reasoning, or examples, or pretty much anything else in it. cheers Derick

Larry Garfield

2 years ago
On Sun, Dec 3, 2023, at 10:34 AM, Derick Rethans wrote:
> On 3 December 2023 14:49:12 GMT, Nikita Popov <nikita.ppv@gmail.com> wrote: >>On Sun, Dec 3, 2023, at 11:40, Daniil Gentili wrote: >>> Hi all, >>> >>> I've just opened voting for the final anonymous classes RFC @ >>> https://wiki.php.net/rfc/final_anonymous_classes. >>> >>> Voting started now, and will run until December 18th 2023, 00:00 GMT. >> >>For the record, I've voted against this proposal because I believe it should have gone with option 2, that is to *always* make anonymous classes final. >> >>It makes very little sense to me that everyone needs to explicitly mark their anonymous classes as final just because there is a class_alias loophole that could, in theory, have been used to extend anonymous classes in the past. Especially given that there is no evidence of this "feature" being used in the wild (or if there is such evidence, it was not presented in the proposal). >> >>Regards, >>Nikita > I agree with this, and would also say that this RFC is the most thin > one I've seen. > > There is no reasoning, or examples, or pretty much anything else in it.
I have also voted no for the same reasons as above. A more fleshed out RFC that goes default-final (which would then enable the engine optimizations mentioned) I would probably vote yes for. Though one could debate if that should be saved for 9.0 just to be safe. (Which I'd also be fine with.) --Larry Garfield

Andreas Heigl

2 years ago
Am 03.12.23 um 19:34 schrieb Larry Garfield:
> On Sun, Dec 3, 2023, at 10:34 AM, Derick Rethans wrote: >> On 3 December 2023 14:49:12 GMT, Nikita Popov <nikita.ppv@gmail.com> wrote: >>> On Sun, Dec 3, 2023, at 11:40, Daniil Gentili wrote: >>>> Hi all, >>>> >>>> I've just opened voting for the final anonymous classes RFC @ >>>> https://wiki.php.net/rfc/final_anonymous_classes. >>>> >>>> Voting started now, and will run until December 18th 2023, 00:00 GMT. >>> >>> For the record, I've voted against this proposal because I believe it should have gone with option 2, that is to *always* make anonymous classes final. >>> >>> It makes very little sense to me that everyone needs to explicitly mark their anonymous classes as final just because there is a class_alias loophole that could, in theory, have been used to extend anonymous classes in the past. Especially given that there is no evidence of this "feature" being used in the wild (or if there is such evidence, it was not presented in the proposal). >>> >>> Regards, >>> Nikita >> I agree with this, and would also say that this RFC is the most thin >> one I've seen. >> >> There is no reasoning, or examples, or pretty much anything else in it. > > I have also voted no for the same reasons as above. A more fleshed out RFC that goes default-final (which would then enable the engine optimizations mentioned) I would probably vote yes for. Though one could debate if that should be saved for 9.0 just to be safe. (Which I'd also be fine with.)
I also voted NO for the same reason. But also because I am missing a few things in the RFC. I am especially missing a reasoning as to why final for anonymous classes is a thing in the first place. What pain is this RFC adressing? (Apart from not being able to write `new final class{}`) Also I'd expect all the relevant information from the discussion to be in the RFC so that we can figure out what the main points were without having to dig through Mailinglists or PRs. Cheers Andreas
-- ,,, (o o) +---------------------------------------------------------ooO-(_)-Ooo-+ | Andreas Heigl | | mailto:andreas@heigl.org N 50°22'59.5" E 08°23'58" | | https://andreas.heigl.org https://hei.gl/where | | https://hei.gl/pubkeyandreas | +---------------------------------------------------------------------+

Sebastian Bergmann

2 years ago
Am 03.12.2023 um 15:49 schrieb Nikita Popov:
> For the record, I've voted against this proposal because I believe it should have gone with option 2, that is to *always* make anonymous classes final.
I voted "no" for exactly the same reason.

Daniil Gentili

2 years ago
Hi all, Thanks for the feedback, sorry the RFC was a bit too thin, given the multiple internals threads I started on the topic, including the latest [RFC] discussion thread, I mistakenly assumed that everyone was already familiar with the topic, even if by just lurking. To reply to some of the feedback received in this thread,
>I am especially missing a reasoning as to why final for anonymous
classes is a thing in the first place. What pain is this RFC adressing? The only real pain I was addressing was indeed the inability to enable some possible opcache optimizations when using final classes, as mentioned in the Proposal section; I believe that that is reason enough to add support for a minor feature like this.
>There is no reasoning, or examples
Added some more reasoning, even though as said both here and the RFC, the reason behind the RFC is quite simple, just allow using some optimizations that were excluded due to an oversight in the original implementation of anonymous classes. Regarding the examples I again mistakenly assumed that everyone was already familiar with the (rather basic) patch and the examples in the testsuite, corrected that mistake now. Regarding the voting options, after feedback received in the last [RFC] discussion thread from Nicolas Grekas:
>Hi Daniil,
>>> While I'm open to Proposal 1, which introduces final anonymous classes >>> without breaking BC, Proposals 2 and 3 are a different story. >>> In summary, I advocate for the RFC to focus on the non-BC-breaking
option.
>>> Let's maintain our commitment to stability and gradual evolution in
PHP.
>>> Cheers, >>> Nicolas
>> Agree with your points, just adding final anonymous classes seems
the best solution to me, but given the interest in alternative solutions both in the pull request discussion, and in the previous mailing list thread, I think I'll leave the other options in the RFC, to see how the votes will go (I'm actually curious myself :).
>> Regards, > Daniil Gentili
>I think this is a dangerous game. Breaking BC shouldn't be proposed
unless absolutely needed IMHO.
>Nicolas
I had moved a large chunk of the rationale and removed basically all the alternative polls I had initially planned to propose; the initial text of the RFC can be seen at the bottom, in the newly updated Rejected Features section (https://wiki.php.net/rfc/final_anonymous_classes). I've also added some additional pro and counterpoints on my own. As I see now, it was a mistake to remove the other two planned voting options just based on a single feedback, thus I would like to ask, would it be OK to add back the two voting options I removed basically a day before opening voting, with end date @ 2023-12-20? Here are the options I removed a few days ago, and would like to add back: - Make all anonymous classes final by default, without the option to make them final? - Yes/No - Make all anonymous classes final by default, provide an optional ''open'' keyword to make them non-final - Yes/No Again to clarify, the voting options would be mutually exclusive as proposed in the original version of the RFC. Regards, Daniil Gentili.