rfc:new_in_initializers
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:new_in_initializers [2021/06/15 14:57] – nikic | rfc:new_in_initializers [2021/06/30 07:51] – nikic | ||
---|---|---|---|
Line 2: | Line 2: | ||
* Date: 2021-03-02 | * Date: 2021-03-02 | ||
* Author: Nikita Popov < | * Author: Nikita Popov < | ||
- | * Status: | + | * Status: |
* Proposed Version: PHP 8.1 | * Proposed Version: PHP 8.1 | ||
* Implementation: | * Implementation: | ||
Line 85: | Line 85: | ||
New expressions continue to not be supported in (static and non-static) property initializers and class constant initializers. The reasons for this are twofold: | New expressions continue to not be supported in (static and non-static) property initializers and class constant initializers. The reasons for this are twofold: | ||
- | For non-static property initializers, | + | For non-static property initializers, |
- | Performing the initialization by injecting code in the constructor avoids the issue, but requires that constructor to actually be called. In particular, this would necessitate generating constructors for classes that do not explicitly declare them, and the disciplined invocation of such constructors from potential | + | Performing the initialization by injecting code in the constructor avoids the issue, but requires that constructor to actually be called. In particular, this would necessitate generating constructors for classes that do not explicitly declare them, and the disciplined invocation of such constructors from potential |
- | For static property initializers and class constant initializers a different evaluation order issue arises. Currently, these initializers are evaluated lazily the first time a class is used in a certain way. Once initializers can contain potentially side-effecting expressions, | + | For static property initializers and class constant initializers a different evaluation order issue arises. Currently, these initializers are evaluated lazily the first time a class is used in a certain way (e.g. instantiated). Once initializers can contain potentially side-effecting expressions, |
- | The discussion has not yielded a satisfactory solution for these concerns, as such support in these contexts is delayed until such a time as a consensus on the preferred behavior can be reached. | + | As such support in these contexts is delayed until such a time as a consensus on the preferred behavior can be reached. |
==== Order of evaluation ==== | ==== Order of evaluation ==== | ||
Line 123: | Line 123: | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
- | This RFC is narrow in that it only adds support for '' | + | This RFC omits support for '' |
+ | |||
+ | With the precedent set by '' | ||
===== Vote ===== | ===== Vote ===== | ||
- | Yes/No. | + | Voting opened on 2021-06-30 and closes on 2021-07-14. |
+ | |||
+ | <doodle title=" | ||
+ | | ||
+ | | ||
+ | </ | ||
rfc/new_in_initializers.txt · Last modified: 2021/07/14 07:19 by nikic