Re: [PHP-DEV] Class static initialization block

2021-09-13 Thread Alexandru Pătrănescu
On Sun, Sep 12, 2021 at 2:28 AM David Rodrigues wrote: > Hello! > > I would like to suggest a feature I saw being implemented in the V8 9.4 > engine called "*class static initialization block*". > > https://v8.dev/blog/v8-release-94 > > In short, it is a method that is executed once when a class

Re: [PHP-DEV] Class static initialization block

2021-09-13 Thread Mike Schinkel
> On Sep 13, 2021, at 12:26 PM, Rowan Tommins wrote: > >> 2.) Make the initialization function private. > > I'm not sure how that would work: a private constructor means that it has to > be explicitly called from within the same class, but a static initialiser > would be called by the engine,

Re: [PHP-DEV] Class static initialization block

2021-09-13 Thread Rowan Tommins
Hi Mike, I will leave others to discuss the use cases. It would be interesting if people could find the motivating use cases that led to support in C#, Java, and JS. I just wanted to comment quickly on these few points, though: On 13/09/2021 15:05, Mike Schinkel wrote: 1.) Use static

Re: [PHP-DEV] Class static initialization block

2021-09-13 Thread Mike Schinkel
> On Sep 11, 2021, at 7:35 PM, Marco Pivetta wrote: > > On Sun, 12 Sep 2021, 01:28 David Rodrigues, wrote: > >> Hello! >> >> I would like to suggest a feature I saw being implemented in the V8 9.4 >> engine called "*class static initialization block*". >> >> https://v8.dev/blog/v8-release-94

Re: [PHP-DEV] Class static initialization block

2021-09-12 Thread Rowan Tommins
On 12 September 2021 00:28:02 BST, David Rodrigues wrote: >Hello! > >I would like to suggest a feature I saw being implemented in the V8 9.4 >engine called "*class static initialization block*". Hi David, There was a similar proposal for PHP a few years ago:

Re: [PHP-DEV] Class static initialization block

2021-09-11 Thread Marco Pivetta
Hey David, On Sun, 12 Sep 2021, 01:28 David Rodrigues, wrote: > Hello! > > I would like to suggest a feature I saw being implemented in the V8 9.4 > engine called "*class static initialization block*". > > https://v8.dev/blog/v8-release-94 > > In short, it is a method that is executed once when

[PHP-DEV] Class static initialization block

2021-09-11 Thread David Rodrigues
Hello! I would like to suggest a feature I saw being implemented in the V8 9.4 engine called "*class static initialization block*". https://v8.dev/blog/v8-release-94 In short, it is a method that is executed once when a class is imported and loaded, allowing for some more advanced