On Thu, Jun 8, 2023, at 5:39 PM, Stephen Reay wrote: > Is there a specific reason `clone with (foo: $bar);` can’t simply pass > the arguments given to with(), to the __clone() magic method? > > It leaves the developer free to use the passed argument(s) or deep > clone existing properties or a mix depending on what’s passed, and > seems like it has the least “magic” or unknown behaviour in terms of > when things happen. > > Just a thought.
I experimented with that a few years back. The results showed it is actually pretty awful in practice. https://peakd.com/hive-168588/@crell/object-properties-part-2-examples --Larry Garfield -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php