On Thu, Jun 17, 2021 at 12:53 PM Côme Chilliet < come.chill...@fusiondirectory.org> wrote:
> Le Wed, 16 Jun 2021 10:16:37 +0200, > Nikita Popov <nikita....@gmail.com> a écrit : > > > 1. Eagerly evaluate initializers on declaration. This is what I tried in > an > > earlier revision of the RFC, and I don't think that approach works. It > > breaks existing code and has various other unpleasant complications. > > 2. Precisely specify the current behavior. I don't want to do this > either, > > because the exact places where evaluation happens are something of an > > implementation detail. If in the future we find it convenient to separate > > evaluation of non-static properties on object instantiation from > evaluation > > of static properties and class constants (which are not strictly needed > at > > that point), I'd like to retain the liberty to make such a change. > > 3. Do not specify an evaluation order, beyond that evaluation happens at > > certain uses of the class. Evaluation order may change across PHP > versions. > > If your code relies on any particular order, your code is broken. > > If option 3 is considered, it means the evaluation order may change, if we > can > change the evaluation order, why not go for option 1? I do not understand > which > existing code can break with option 1 and be fine with option 3, it means > this > code relies on undefined behaviors, no? > > Côme > > I think this message might have more details for why option 1 is not simple to solve: https://externals.io/message/113347#113607