On Thu, Apr 20, 2023, at 7:22 AM, Aleksander Machniak wrote:
> On 20.04.2023 09:00, Rowan Tommins wrote:
>> Rather than making everything use an array or array-like syntax, I would 
>> probably go the other way and scrap the special syntax for dynamic names, 
>> making the whole thing look like a function call, with support for array 
>> unpacking:
>> 
>> $point = clone $point with (x: $x, y: $y, z: $z);
>> $point = clone $point with (...['x' => $x, 'y' => $y, 'z' => $z]);
>
> 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. :-)

--Larry Garfield

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to