Re: [RFC] [Discussion] Clone with

From: Date: Fri, 09 Jun 2023 00:11:24 +0000
Subject: Re: [RFC] [Discussion] Clone with
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-120548@lists.php.net to get a copy of this message
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

« previous php.internals (#120548) next »