Hi
On 5/30/23 18:37, Larry Garfield wrote:
To be honest, the current behavior seemed like the natural choice for
me, and I didn't really consider to execute the __clone() method after the
clone assignments.
Do you have a use-case in mind when you need to forward-pass information to
__clone()?
Not a specific one off hand. It's more a conceptual question. `with` has more
contextual awareness than __clone(), so it should have "first crack" at the
operation, so that if necessary it can make changes that __clone() can then respond to.
The inverse doesn't make sense.
The only reason for `with` to come after would be to allow `with` to "override" or
"undo" something that __clone() did. Generally speaking, if you have to undo something
you just did, you shouldn't have done it in the first place, so that's a less compelling
combination.
This one isn't a deal breaker, but we should be sure to think it through as
it's kinda hard to reverse later.
FWIW if I would've create the implementation, I intuitively would also
have chosen to first execute __clone() and then set the properties. Of
course this isn't a well-argued reason to do it this way, but I wanted
to share it nonetheless.
Best regards
Tim Düsterhus
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php