rfc:final_by_default_anonymous_classes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:final_by_default_anonymous_classes [2024/01/15 09:55] – danog | rfc:final_by_default_anonymous_classes [2024/02/06 19:51] (current) – Move to declined ilutov | ||
---|---|---|---|
Line 2: | Line 2: | ||
* Date: 2023-12-23 | * Date: 2023-12-23 | ||
* Author: Daniil Gentili < | * Author: Daniil Gentili < | ||
- | * Status: | + | * Status: |
===== Introduction ===== | ===== Introduction ===== | ||
Line 12: | Line 12: | ||
This RFC proposes to make anonymous classes final by default. | This RFC proposes to make anonymous classes final by default. | ||
- | This should also allow some additional opcache optimizations, | + | The main reason for this change, in my view, is to allow some additional opcache optimizations, |
+ | |||
+ | Another reason is mentioned by Nikita in https:// | ||
Example, extending an anonymous class throws an error: | Example, extending an anonymous class throws an error: | ||
Line 27: | Line 29: | ||
- | Optionally, an '' | + | Optionally, an '' |
Example, extending an open anonymous class does not throw an error: | Example, extending an open anonymous class does not throw an error: | ||
Line 37: | Line 39: | ||
</ | </ | ||
- | On one hand, looking at code like '' | + | Rationale regarding '' |
+ | |||
+ | On one hand, looking at code like '' | ||
- Has a name (even if it's not immediately obvious) | - Has a name (even if it's not immediately obvious) | ||
Line 48: | Line 52: | ||
Still, there are some useful patterns, mainly regarding testing and mocking, for example I use https:// | Still, there are some useful patterns, mainly regarding testing and mocking, for example I use https:// | ||
- | This is why I remain ambivalent about the options, as seen both in my emails and in the original text of the RFC: | + | Thus, I also propose |
- | Personally, I would have instead preferred the much cleaner approach of making all anonymous classes final by default, (preferrably) without offering the option to make them non-final. | + | The implementation PR will be provided |
- | + | ||
- | However, I understand that this might be a little bit too restrictive for something that may have some valid usecases, even if extending anonymous classes currently requires some hack-ish workarounds with class_alias. | + | |
- | + | ||
- | As an extra proposal possibly requiring a separate RFC, it might be a good idea to also disallow the use of '' | + | |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
Line 69: | Line 69: | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
+ | |||
+ | Voting started on January 15th, 2024 and runs until January 30th, 2024, 00:00 UTC. | ||
2/3 required to accept. | 2/3 required to accept. | ||
- | <doodle title=" | + | <doodle title=" |
* Yes | * Yes | ||
* No | * No | ||
</ | </ | ||
- | <doodle title=" | + | |
+ | 2/3 required to accept. | ||
+ | |||
+ | <doodle title=" | ||
* Yes | * Yes | ||
* No | * No | ||
Line 85: | Line 90: | ||
===== References ===== | ===== References ===== | ||
- | * Internals discussion: https:// | + | * Internals discussion: |
* Previous optionally final anonymous classes RFC: https:// | * Previous optionally final anonymous classes RFC: https:// | ||
rfc/final_by_default_anonymous_classes.1705312527.txt.gz · Last modified: 2024/01/15 09:55 by danog