Re: [RFC] [Discussion] Clone with

From: Date: Thu, 20 Apr 2023 17:17:33 +0000
Subject: Re: [RFC] [Discussion] Clone with
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-120082@lists.php.net to get a copy of this message
On 20.04.2023 16:15, Larry Garfield wrote:
or $point = clone($point, x: $x, y: $y, z: $z); Also, I didn't see it mentioned, but maybe for future scope, these new arguments should be passed to __clone().
They should not. See https://peakd.com/hive-168588/@crell/object-properties-part-2-examples . I went through and experimented with different syntaxes, and passing arguments to __clone() was by far the worst option in practice. :-)
Sure, I didn't propose it to be a solution for "clone with", but rather, if we implement "clone with" (no matter in which way) this is "cloning an object with extra properties", so therefore one would ask to have access to these extra properties inside __clone(). I'm not sure how useful that could be, but maybe worth mentioning in future scope or somewhere in the RFC. And I think this syntax should still be on the table, no need for a new keyword. $point = clone($point, x: $x, y: $y, z: $z); -- Aleksander Machniak Kolab Groupware Developer [https://kolab.org] Roundcube Webmail Developer [https://roundcube.net] ---------------------------------------------------- PGP: 19359DC1 # Blog: https://kolabian.wordpress.com

« previous php.internals (#120082) next »