> On Jun 17, 2021, at 5:14 AM, Nicolas Grekas <nicolas.grekas+...@gmail.com> 
> wrote:
> 
> Le mer. 16 juin 2021 à 13:47, Larry Garfield <la...@garfieldtech.com> 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 fail because of either a throwing constructor or
> because of a throwing autoloader.
> 
> Being able to know where to put the try/catch to recover from these might
> be important when writing generic code.
> 

> With the current state of the RFC, it's fine. With "undefined evaluation
> time", it might make things fragile without any way to make them resilient
> enough.

Wouldn't the simple way to make them resilient enough be to wrap a try-catch 
block around any code that potentially throws an exception within the class 
being instantiated on initialization?

-Mike
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to