Re: [PHP-DEV] [RFC] New in initializers

2021-06-28 Thread Nikita Popov
On Tue, Jun 15, 2021 at 5:06 PM Nikita Popov wrote: > On Fri, Jun 11, 2021 at 5:02 PM Larry Garfield > wrote: > >> On Wed, Mar 3, 2021, at 9:03 AM, Nikita Popov wrote: >> > Hi internals, >> > >> > I would like to propose allowing the use of "new" inside various >> > initializer expressions: http

Re: [PHP-DEV] [RFC] New in initializers

2021-06-21 Thread Björn Larsson via internals
Den 2021-06-17 kl. 12:08, skrev Nikita Popov: On Thu, Jun 17, 2021 at 11:53 AM Côme Chilliet < come.chill...@fusiondirectory.org> wrote: Le Wed, 16 Jun 2021 10:16:37 +0200, Nikita Popov a écrit : 1. Eagerly evaluate initializers on declaration. This is what I tried in an earlier revision o

Re: [PHP-DEV] [RFC] New in initializers

2021-06-17 Thread Nikita Popov
On Thu, Jun 17, 2021 at 11:14 AM Nicolas Grekas < nicolas.grekas+...@gmail.com> wrote: > Le mer. 16 juin 2021 à 13:47, Larry Garfield a > écrit : > > > On Wed, Jun 16, 2021, at 3:16 AM, Nikita Popov wrote: > > > > > > Arguments and attributes are enough to justify this RFC on its own, > > but is

Re: [PHP-DEV] [RFC] New in initializers

2021-06-17 Thread Nikita Popov
On Thu, Jun 17, 2021 at 11:53 AM Côme Chilliet < come.chill...@fusiondirectory.org> wrote: > Le Wed, 16 Jun 2021 10:16:37 +0200, > Nikita Popov 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 app

Re: [PHP-DEV] [RFC] New in initializers

2021-06-17 Thread Alexandru Pătrănescu
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 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 app

Re: [PHP-DEV] [RFC] New in initializers

2021-06-17 Thread Côme Chilliet
Le Wed, 16 Jun 2021 10:16:37 +0200, Nikita Popov 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 s

Re: [PHP-DEV] [RFC] New in initializers

2021-06-17 Thread Mike Schinkel
> On Jun 17, 2021, at 5:14 AM, Nicolas Grekas > wrote: > > Le mer. 16 juin 2021 à 13:47, Larry Garfield a > écrit : >> Would others be comfortable with that, if it allowed new-initializers for >> static properties and class constants? >> > > Honestly, I don't know. > > Instantiation might fa

Re: [PHP-DEV] [RFC] New in initializers

2021-06-17 Thread Nicolas Grekas
Le mer. 16 juin 2021 à 13:47, Larry Garfield a écrit : > On Wed, Jun 16, 2021, at 3:16 AM, Nikita Popov wrote: > > > > Arguments and attributes are enough to justify this RFC on its own, > but is > > > there a way we can resolve the static property question? Right now > the RFC > > > says "these

Re: [PHP-DEV] [RFC] New in initializers

2021-06-17 Thread Alexandru Pătrănescu
On Wed, Jun 16, 2021 at 11:17 AM Nikita Popov wrote: > > > The options where static properties and class constants are concerned are: > > 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 e

Re: [PHP-DEV] [RFC] New in initializers

2021-06-16 Thread Mike Schinkel
> On Jun 16, 2021, at 7:47 AM, Larry Garfield wrote: > > On Wed, Jun 16, 2021, at 3:16 AM, Nikita Popov wrote: > > Given that constructors that have side effects are arguably broken to begin > with (modulo debugging), I'd be comfortable with explicitly saying that the > evaluation order is und

Re: [PHP-DEV] [RFC] New in initializers

2021-06-16 Thread Larry Garfield
On Wed, Jun 16, 2021, at 3:16 AM, Nikita Popov wrote: > > Arguments and attributes are enough to justify this RFC on its own, but is > > there a way we can resolve the static property question? Right now the RFC > > says "these initializers are evaluated lazily the first time a class is > > used

Re: [PHP-DEV] [RFC] New in initializers

2021-06-16 Thread Nikita Popov
On Tue, Jun 15, 2021 at 6:31 PM Larry Garfield wrote: > On Tue, Jun 15, 2021, at 10:06 AM, Nikita Popov wrote: > > On Fri, Jun 11, 2021 at 5:02 PM Larry Garfield > > wrote: > > > > > On Wed, Mar 3, 2021, at 9:03 AM, Nikita Popov wrote: > > > > Hi internals, > > > > > > > > I would like to propos

Re: [PHP-DEV] [RFC] New in initializers

2021-06-15 Thread Mike Schinkel
> On Jun 15, 2021, at 11:06 AM, Nikita Popov wrote: > > On Fri, Jun 11, 2021 at 5:02 PM Larry Garfield > > wrote: > >> On Wed, Mar 3, 2021, at 9:03 AM, Nikita Popov wrote: >>> Hi internals, >>> >>> I would like to propose allowing the use of "new" inside various

Re: [PHP-DEV] [RFC] New in initializers

2021-06-15 Thread Larry Garfield
On Tue, Jun 15, 2021, at 10:06 AM, Nikita Popov wrote: > On Fri, Jun 11, 2021 at 5:02 PM Larry Garfield > wrote: > > > On Wed, Mar 3, 2021, at 9:03 AM, Nikita Popov wrote: > > > Hi internals, > > > > > > I would like to propose allowing the use of "new" inside various > > > initializer expression

Re: [PHP-DEV] [RFC] New in initializers

2021-06-15 Thread Nikita Popov
On Fri, Jun 11, 2021 at 5:02 PM Larry Garfield wrote: > On Wed, Mar 3, 2021, at 9:03 AM, Nikita Popov wrote: > > Hi internals, > > > > I would like to propose allowing the use of "new" inside various > > initializer expressions: https://wiki.php.net/rfc/new_in_initializers > > > > In particular,

Re: [PHP-DEV] [RFC] New in initializers

2021-06-11 Thread Larry Garfield
On Wed, Mar 3, 2021, at 9:03 AM, Nikita Popov wrote: > Hi internals, > > I would like to propose allowing the use of "new" inside various > initializer expressions: https://wiki.php.net/rfc/new_in_initializers > > In particular, this allows specifying object default values for properties > and pa

Re: [PHP-DEV] [RFC] New in initializers

2021-05-11 Thread Larry Garfield
On Tue, May 11, 2021, at 8:57 AM, Rowan Tommins wrote: > On 11/05/2021 14:12, Dik Takken wrote: > > So the use of "new" in initializers would require extending this base > > class and call the parent constructor. Maybe forgetting to do so could > > throw, preventing initializers from silently not w

Re: [PHP-DEV] [RFC] New in initializers

2021-05-11 Thread Rowan Tommins
On 11/05/2021 14:12, Dik Takken wrote: So the use of "new" in initializers would require extending this base class and call the parent constructor. Maybe forgetting to do so could throw, preventing initializers from silently not working. If we managed to get that working, I wonder if we could

Re: [PHP-DEV] [RFC] New in initializers

2021-05-11 Thread Dik Takken
On 11-05-2021 11:56, Nikita Popov wrote: > > An issue for using new in (non-static) properties is that these objects are > going to get created even if the constructor doesn't run. This could be a > problem for things like unserialize() and anything that implements related > functionality in userl

Re: [PHP-DEV] [RFC] New in initializers

2021-05-11 Thread Nikita Popov
On Fri, Mar 19, 2021 at 2:02 PM Nikita Popov wrote: > On Fri, Mar 19, 2021 at 12:57 PM Nikita Popov > wrote: > >> On Fri, Mar 19, 2021 at 12:22 PM Nikita Popov >> wrote: >> >>> On Wed, Mar 3, 2021 at 7:04 PM Alexandru Pătrănescu >>> wrote: >>> On Wed, Mar 3, 2021 at 5:49 PM Nikita Po

Re: [PHP-DEV] [RFC] New in initializers

2021-03-20 Thread Claude Pache
> Le 19 mars 2021 à 12:22, Nikita Popov > a écrit : > > I've updated the RFC (and implementation) to evaluate class constants and > static properties at time of class declaration. As such, everything should > have a well-defined evaluation order now. > > However, t

Re: [PHP-DEV] [RFC] New in initializers

2021-03-19 Thread Nikita Popov
On Fri, Mar 19, 2021 at 12:57 PM Nikita Popov wrote: > On Fri, Mar 19, 2021 at 12:22 PM Nikita Popov > wrote: > >> On Wed, Mar 3, 2021 at 7:04 PM Alexandru Pătrănescu >> wrote: >> >>> >>> On Wed, Mar 3, 2021 at 5:49 PM Nikita Popov >>> wrote: >>> On Wed, Mar 3, 2021 at 4:28 PM Alexandru P

Re: [PHP-DEV] [RFC] New in initializers

2021-03-19 Thread Nikita Popov
On Fri, Mar 19, 2021 at 12:22 PM Nikita Popov wrote: > On Wed, Mar 3, 2021 at 7:04 PM Alexandru Pătrănescu > wrote: > >> >> On Wed, Mar 3, 2021 at 5:49 PM Nikita Popov wrote: >> >>> On Wed, Mar 3, 2021 at 4:28 PM Alexandru Pătrănescu >>> wrote: >>> Hi, This looks very nice and I

Re: [PHP-DEV] [RFC] New in initializers

2021-03-19 Thread Nikita Popov
On Wed, Mar 3, 2021 at 7:04 PM Alexandru Pătrănescu wrote: > > On Wed, Mar 3, 2021 at 5:49 PM Nikita Popov wrote: > >> On Wed, Mar 3, 2021 at 4:28 PM Alexandru Pătrănescu >> wrote: >> >>> Hi, >>> >>> This looks very nice and I'm interested in further steps where not only >>> new can be used :).

Re: [PHP-DEV] [RFC] New in initializers

2021-03-05 Thread Nikita Popov
On Thu, Mar 4, 2021 at 5:26 PM Larry Garfield wrote: > On Thu, Mar 4, 2021, at 7:53 AM, Nikita Popov wrote: > > > I've added a section that describes reflection methods. It works exactly > as > > you say. > > > > There is one interesting case though: How should > > ReflectionObject::newInstanceWi

Re: [PHP-DEV] [RFC] New in initializers

2021-03-04 Thread Larry Garfield
On Thu, Mar 4, 2021, at 7:53 AM, Nikita Popov wrote: > I've added a section that describes reflection methods. It works exactly as > you say. > > There is one interesting case though: How should > ReflectionObject::newInstanceWithoutConstructor() work? In the current > implementation, it will sti

Re: [PHP-DEV] [RFC] New in initializers

2021-03-04 Thread Nikita Popov
On Thu, Mar 4, 2021 at 4:26 PM Gabriel O wrote: > > On Wed, 3 Mar 2021 at 16:04, Nikita Popov wrote: > >> Hi internals, >> >> I would like to propose allowing the use of "new" inside various >> initializer expressions: https://wiki.php.net/rfc/new_in_initializers >> >> In particular, this allows

Re: [PHP-DEV] [RFC] New in initializers

2021-03-04 Thread Gabriel O
On Wed, 3 Mar 2021 at 16:04, Nikita Popov wrote: > Hi internals, > > I would like to propose allowing the use of "new" inside various > initializer expressions: https://wiki.php.net/rfc/new_in_initializers > > In particular, this allows specifying object default values for properties > and parame

Re: [PHP-DEV] [RFC] New in initializers

2021-03-04 Thread Nikita Popov
On Wed, Mar 3, 2021 at 7:04 PM Alexandru Pătrănescu wrote: > > On Wed, Mar 3, 2021 at 5:49 PM Nikita Popov wrote: > >> On Wed, Mar 3, 2021 at 4:28 PM Alexandru Pătrănescu >> wrote: >> >>> Hi, >>> >>> This looks very nice and I'm interested in further steps where not only >>> new can be used :).

Re: [PHP-DEV] [RFC] New in initializers

2021-03-04 Thread Nikita Popov
On Thu, Mar 4, 2021 at 6:21 AM Michał Marcin Brzuchalski < michal.brzuchal...@gmail.com> wrote: > Hi Nikita, > > śr., 3 mar 2021, 16:04 użytkownik Nikita Popov > napisał: > >> Hi internals, >> >> I would like to propose allowing the use of "new" inside various >> initializer expressions: https://

Re: [PHP-DEV] [RFC] New in initializers

2021-03-03 Thread Michał Marcin Brzuchalski
Hi Nikita, śr., 3 mar 2021, 16:04 użytkownik Nikita Popov napisał: > Hi internals, > > I would like to propose allowing the use of "new" inside various > initializer expressions: https://wiki.php.net/rfc/new_in_initializers > > In particular, this allows specifying object default values for prop

Re: [PHP-DEV] [RFC] New in initializers

2021-03-03 Thread Benjamin Eberlei
This is On Wed, Mar 3, 2021 at 4:04 PM Nikita Popov wrote: > Hi internals, > > I would like to propose allowing the use of "new" inside various > initializer expressions: https://wiki.php.net/rfc/new_in_initializers > > In particular, this allows specifying object default values for properties >

Re: [PHP-DEV] [RFC] New in initializers

2021-03-03 Thread Alexandru Pătrănescu
On Wed, Mar 3, 2021 at 5:49 PM Nikita Popov wrote: > On Wed, Mar 3, 2021 at 4:28 PM Alexandru Pătrănescu > wrote: > >> Hi, >> >> This looks very nice and I'm interested in further steps where not only >> new can be used :). >> >> The only thing I think it would be good to improve is to have a >>

Re: [PHP-DEV] [RFC] New in initializers

2021-03-03 Thread Ben Ramsey
> On Mar 3, 2021, at 09:03, Nikita Popov wrote: > > Hi internals, > > I would like to propose allowing the use of "new" inside various > initializer expressions: https://wiki.php.net/rfc/new_in_initializers > > In particular, this allows specifying object default values for properties > and par

Re: [PHP-DEV] [RFC] New in initializers

2021-03-03 Thread Nikita Popov
On Wed, Mar 3, 2021 at 4:28 PM Alexandru Pătrănescu wrote: > Hi, > > This looks very nice and I'm interested in further steps where not only > new can be used :). > > The only thing I think it would be good to improve is to have a > deterministic order for running initialization. > Yes, this can

Re: [PHP-DEV] [RFC] New in initializers

2021-03-03 Thread Alexandru Pătrănescu
Hi, This looks very nice and I'm interested in further steps where not only new can be used :). The only thing I think it would be good to improve is to have a deterministic order for running initialization. Yes, this can be done at a later point, I guess. But maybe there is already an order of i

[PHP-DEV] [RFC] New in initializers

2021-03-03 Thread Nikita Popov
Hi internals, I would like to propose allowing the use of "new" inside various initializer expressions: https://wiki.php.net/rfc/new_in_initializers In particular, this allows specifying object default values for properties and parameters, and allows the use of objects as attribute arguments. Th