Re: First-class constructor callables

From: Date: Fri, 21 Nov 2025 03:47:00 +0000
Subject: Re: First-class constructor callables
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-129353@lists.php.net to get a copy of this message
On Thursday, 20 November 2025 at 16:40, Arnaud Le Blanc <arnaud.lb@gmail.com> wrote: > On Thu, Nov 20, 2025 at 3:21 PM Arnaud Le Blanc arnaud.lb@gmail.com wrote: > > > Hi Valentin, > > > > On Thu, Nov 20, 2025 at 2:20 PM Valentin Udaltsov > > udaltsov.valentin@gmail.com wrote: > > > > > Question for Larry and Arnaud: > > > > > > In PFA v2, you note that constructor references pose significant technical > > > challenges. > > > Could you elaborate on what those challenges are and whether they are fundamental, or > > > potentially addressable with a more limited or explicit syntax such as new > > > Foo(...)? > > > > One issue is that partial application needs to resolve the function > > being applied, but constructors can not be resolved without > > instantiating the class first (at least, not on all classes). > > > To clarify, constructors are normally resolved after creating an > object, by calling the get_constructor() handler on the object. The > handler isn't known before creating the object, at least for internal > classes, so we can't resolve a constructor without creating an object > first. This would have to be addressed in order to support partial > application of classes. Oh so one more reason to get rid of the get_constructor() handler then. Would the approach that I started prototyping in https://github.com/php/php-src/pull/19797 help as we would know the zend_function the moment we have the CE? Best regards, Gina P. Banyard

« previous php.internals (#129353) next »