On 29.05.2023 14:12, Aleksander Machniak wrote:
In "Property name expressions" section's first code example I think you
intended to do `clone $self` (not `clone $this`) inside the foreach() loop.
Also, I have a feeling that it would be better to implement `clone
$object with $properties` syntax first and if that is accepted think
about expressions support. It's not a strong feeling though.
Actually, with some more thought, my opinion now is that introduction of
property name expressions is not justified. And will be a reason for me
to vote No.
I'm still not decided about which syntax I'd prefer, maybe you should do
a poll with these basic options. Sorry, if there was one and I missed it.
1) clone $object with $properties;
2) clone($object, $properties);
3) clone($object, prop1: $var1, prop2: $var2);
4) clone($object, function ($clone) use ($properties) {
foreach ($properties as $name => $value) {
$clone->{$name} = $value;
}
});
5) clone $obj with (prop1: $var1, prop2: $var2);
note: $properties is iterable
note: in 2-4) brackets are potentially optional.
note: imho, 5) is similar to 3), but worse.
--
Aleksander Machniak
Kolab Groupware Developer [https://kolab.org]
Roundcube Webmail Developer [https://roundcube.net]
----------------------------------------------------
PGP: 19359DC1 # Blog: https://kolabian.wordpress.com
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php