On Thu, Apr 4, 2019 at 4:15 PM CHU Zhaowei <m...@jhdxr.com> wrote:

> Hi internals,
>
> Thanks for the people who joined the discussion of my [RFC: Spread
> Operator in Array Expression](
> https://wiki.php.net/rfc/spread_operator_for_array). The biggest change
> is I have dropped the support for string keys in v0.2 as suggested by Côme,
> to make the behavior of spread operator consistent. I have also added Q&A
> to explain the questions I received.
>

This looks reasonable to me. My only concern would be the "by-reference
passing" section of the RFC. The current proposal states that [...$arr]
will preserve references in $arr, which is not the behavior I would expect.

Is this choice for parity with the unpacking functionality in calls? In
that case I think it is important to understand that for argument unpacking
the handling of references is decided by the called function, not what is
in the array. If the function accepts an argument by-reference, then the
corresponding element in the array will be turned into a reference
(regardless of whether it was one before). Conversely, if the function
accepts an argument by-value, then the element from the array will be
passed by-value (regardless of whether it was a reference before). A
similar concept doesn't really exist for unpacking in arrays.

Regards,
Nikita

Reply via email to