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

From: Date: Fri, 05 Apr 2019 08:03:40 +0000
Subject: Re: [RFC] Spread Operator in Array Expression v0.2
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-105095@lists.php.net to get a copy of this message
> Le 5 avr. 2019 à 09:45, Stijn Peeters <ik@stijnpeeters.nl> a écrit : > > Hi, > > If I understand correctly it is possible in this proposal to use normal arguments after using > an unpackable argument: > > $arr4 = array(...$arr1, ...$arr2, 111); //valid > > This is something that is not possible when using argument unpacking in function calls: > > $result = someFunction(...$arr1, ...$arr2, 111); //invalid > > While I personally like the more permissive variety in this RFC, I think this could be a > confusing inconsistency, and for clarity's sake it would be better to keep both instances of > the unpacking syntax as consistent with each other as possible. > > Best, > Stijn > > That begs the question: why is this invalid for function calls? In fact, I am able to easily hack around the limitation: $result = someFunction(...$arr1, ...$arr2, ...[111]); // valid but the limitation seems just an unnecessary annoyance. —Claude

« previous php.internals (#105095) next »