> Le 13 avr. 2019 à 11:09, Stijn Peeters <i...@stijnpeeters.nl> 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


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

Reply via email to