On 19/06/2024 13:33, Erick de Azevedo Lima wrote:
I searched internals and found a discussion from almost a decade ago.
That discussion did not end well, mostly because of insulting accusations.
If you're talking about the March/April 2015 thread, I don't think
that's a fair summary. There were some slightly ill-mannered comments
about the use cases, but mostly even those instinctively against were
willing to discuss the details of the proposal.
The discussion ended not because of any bad feelings, but because the
person proposing it had to put it on pause because of things happening
in their personal life, and evidently did not pick it back up again:
https://externals.io/message/85779#85985
- Initial thread: https://externals.io/message/84602
- RFC draft thread: https://externals.io/message/85779
- RFC draft: https://wiki.php.net/rfc/static_class_constructor
Digging through the archives, I actually found some even older threads,
though none of them seems to have reached a full proposal:
- 2004 - https://externals.io/message/13183
- 2010 - https://externals.io/message/49435
- 2013 - https://externals.io/message/65078
So, there's definitely desire out there, but also some challenges. A few
things look to have come up again and again (other than whether the use
cases are justified):
- Naming (yay bikeshedding!)
- Whether it should be declared the same way as other magic methods, or
have special rules (e.g. different syntax, private even though it's
called by the engine, error if you explicitly call it)
- Exactly when it should run (on class load? on first access?). (Like
Ilija, I was also reminded of Nikita's comments on the "new in
initializers" RFC, which touch on this point)
- Concerns about implementation details and interaction with other features
Personally, I'm on the fence. I've never had a particular desire for it
myself, and worry that it would be hard to understand or debug exactly
when it was triggered, but can see there is both a desire and a precedent.
Regards,
--
Rowan Tommins
[IMSoP]