Hi Volker, Thanks for the update.
Le lun. 26 mai 2025 à 16:05, Volker Dusch <vol...@tideways-gmbh.com> a écrit : > Version 1.1 Update: Array syntax over named arguments. > > Thank you everyone for the discussion and for improving this RFC. I'm very > happy with the updates we made thanks to your feedback on and off list. > > The main idea of this RFC was to have as little of a footprint as possible > and make it feel natural in PHP. I got carried away a bit during writing > this, and by using named arguments, introduced something that isn't used in > php-src provided functions, had edge cases that required documentation, and > all in all, didn't feel natural in PHP but like an inconsistency. PHP uses > arrays to pass lists everywhere else, so changing this here feels like too > much scope for this little change. I'm very happy this was caught and > raised in the discussions. Thank you. > > If there is desire for named-parameter-as-an-array syntax this should be > standalone RFC with more scope than a single function. > > We've updated the RFC and the implementation, removing the "Open Issue" > listed before, as this change resolved all of them. > > - https://wiki.php.net/rfc/clone_with_v2 > - https://github.com/TimWolla/php-src/pull/6 > To me, it would have made more sense to still make "clone" an operator but I think we can all get used to the array style, so if the majority thinks arrays should be the way to go, so be it. I think the RFC is missing a few bits to be complete: - making "clone" a function means suddenly a "use clone;" or a "\clone" is going to be needed to not get a perf hit, isn't it? But since $y = clone $x; is still going to be valid, how will this be handled? The RFC could give some more hints on the topic. - writing code with a wide range of supported PHP versions means we'll start using construct such as: if (PHP_VERSION_ID>=80500) { $b = 'clone'($a, [...]); // note 'clone' is a string here, so that the line is valid syntax on PHP <= 8.4 else { // another code path for PHP 8.4 } That's of course because "use clone", "\clone" or "clone($foo)" is invalid PHP syntax currently. It could make sense to tell about this and show an example like this one in the RFC. - what if one gives a mangled property in the array? clone($foo, ["\0Foo\0bar" => 123]) It could be useful to write something about this case and/or at least have a test case that shows how this should behave. - To me, the main technical drawback of the RFC is that it builds on mandatory deep-cloning, which means wasted CPU/mem resources by design. This has to be mentioned in the RFC IMHO so that voters can make an informed decision. About this last point, it's the one that makes me undecided about my voting decision on the RFC. I shared my concern and a solution in another thread, where I also address the BC concern that is mentioned in the RFC. Since this concern has been addressed, I think this should be considered more closely. As is, that's a big omission to me - recognizing and addressing the issue with deep-cloning. Cheers, Nicolas