Re: [RFC] Spread Operator in Array Expression v0.2
| From: | Dan Ackroyd | Date: | Sat, 06 Apr 2019 05:36:50 +0000 |
| Subject: | Re: [RFC] Spread Operator in Array Expression v0.2 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105121@lists.php.net to get a copy of this message | ||
On Fri, 5 Apr 2019 at 09:03, Claude Pache <claude.pache@gmail.com> wrote:
>
> That begs the question: why is this invalid for function calls?
At least in part, because if we ever wanted to add a standard
_toArray() method, like we have __toString(), it would be quite a
massive BC break if we already made it so that PHP automatically
encased a single variable into an array, where an array was expected.
> 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.
Typing a couple of extra characters, to avoid needing extra magic
behaviour, seems a good trade-off to me.
cheers
Dan
Ack