Re: [PHP-DEV] [RFC] Spread Operator in Array Expression v0.2

This is only part of a thread. view whole thread
April 13, 2019 14:07 (Claude Pache)
> Le 13 avr. 2019 à 11:09, Stijn Peeters <> a écrit : > > Is anyone aware of other arguments for not allowing normal arguments after > unpackable arguments in function calls?
I've grabbed into the archives of internals. Apart from technical issues: The main argument against that affordance was static analysis; i.e., in `f(...$a, $b)`, it cannot be known until runtime at what position is the argument `$b`. An interesting particular case is that an unfortunate programmer might write `strpos(...$arr, $offset)`, not realising that it is not equivalent to `strpos($arr[0], $arr[1], $offset)`. Another argument was readability, i.e. difficulty to sort out positions with and without spread when they are intermixed. For the case of spread operator in arrays, the static analysis argument probably does not apply. —Claude