rfc:final_class_const
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:final_class_const [2021/05/04 15:06] – kocsismate | rfc:final_class_const [2021/05/08 13:57] – kocsismate | ||
---|---|---|---|
Line 4: | Line 4: | ||
* Status: Under discussion | * Status: Under discussion | ||
* Implementation: | * Implementation: | ||
+ | * Target Version: PHP 8.1 | ||
===== Introduction ===== | ===== Introduction ===== | ||
Line 11: | Line 12: | ||
First of all, the engine can't optimize class constant references when late static binding is involved, so it has to pessimistically assume that '' | First of all, the engine can't optimize class constant references when late static binding is involved, so it has to pessimistically assume that '' | ||
- | What's more important is that class constants are not guaranteed to stay constant. Even if one always references them by using '' | + | What's more important is that class constants are not guaranteed to stay constant. Even if the declaring class always references them by using '' |
- | An interesting fact is that interface constants are already '' | + | A related |
<code php> | <code php> | ||
Line 29: | Line 30: | ||
</ | </ | ||
- | This leads to an interesting | + | This leads to a weird inconsistency. By introducing an intermediate class, overriding still becomes possible: |
<code php> | <code php> | ||
Line 88: | Line 89: | ||
===== Reflection ===== | ===== Reflection ===== | ||
- | A '' | + | A '' |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== |
rfc/final_class_const.txt · Last modified: 2021/07/06 20:52 by kocsismate