On Tue, Apr 25, 2023, at 11:23 AM, Nicolas Grekas wrote: > What about using a real closure to define the scope we need for cloning? > That closure would take the cloned instance as argument to allow > manipulating it at will.
I believe someone mentioned that one previously in the thread. The problem is that the closure would run in the scope of the object, not the scope of the caller. That means if called outside the object, it would allow modifying private or protected properties. The itemized list of values (whether an array or named-args style) would allow the engine to enforce access restrictions, which is a desireable feature. --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php