On Tuesday, 4 June 2024 at 13:28, Nicolas Grekas <nicolas.grekas+...@gmail.com> 
wrote:

> Dear all,
>
> Arnaud and I are pleased to share with you the RFC we've been shaping for 
> over a year to add native support for lazy objects to PHP.
>
> Please find all the details here:
> https://wiki.php.net/rfc/lazy-objects
>
> We look forward to your thoughts and feedback.
>
> Cheers,
> Nicolas and Arnaud

Hello,

I don't have any strong opinions about the feature in general, mainly because I 
don't understand the problem space.

However, I have some remarks.

The fact that an initialize() method has a $skipInitializer parameter doesn't 
make a lot of sense to me.
Because at a glance, I don't see how passing true to it, and not calling the 
method is different?
This should probably be split into two distinct methods.

Does get_mangled_object_vars() trigger initialization or not?
This should behave like an (array) cast (and should be favoured instead of an 
array cast as it was introduced for that purpose).

How does a lazy object look like when it has been dumped?

> The initializer must return null or no value
*Technically* all functions in PHP return a value, which by default is null, so 
this is somewhat redundant.
Also, would this throw a TypeError if a value other than null is returned?

Best regards,
Gina P. Banyard

Reply via email to