Re: [RFC] Static Constructor
Hi Erick,
śr., 19 cze 2024 o 14:35 Erick de Azevedo Lima <[email protected]>
napisał(a):
> Hello everybody.
>
> I found myself wanting this feature (that I first encountered when
> programming in C#) for removing a workaround from a codebase I work from
> time to time.
> I searched internals and found a discussion from almost a decade ago. That
> discussion did not end well, mostly because of insulting accusations.
> I then decided to do some research on this subject and found out that it's
> a pretty common feature in other OOP languages.
> Also, as I started studying the php-src (and missed the days when I used
> to program in C in my main job), I decided to do an implementation myself
> even before presenting the RFC.
> The implementation link can also be found at the RFC.
>
> You can read the RFC here:
> https://wiki.php.net/rfc/static_constructor
>
> Regards,
>
> Erick
>
I like the idea of having a static initializer.
I think we could propose a better naming, method name `function
__staticConstructor` is a concatenation of the words static and constructor
while constructor is used as an initializer when building constructing
objects.
Have you considered naming it for example shortly function __static()
?
It is somehow similar to https://wiki.php.net/rfc/static_constructor#java
in static-block.
Cheers,
Michał Marcin Brzuchalski
Thread (16 messages)