Re: RFC proposal for alternative list syntax
| From: | Pierre Joye | Date: | Mon, 28 Dec 2015 03:56:29 +0000 |
| Subject: | Re: RFC proposal for alternative list syntax | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-89905@lists.php.net to get a copy of this message | ||
On Mon, Dec 28, 2015 at 6:20 AM, Stanislav Malyshev <smalyshev@gmail.com> wrote:
> Hi!
>
>> // With the new array syntax this has been improved to
>>
>> list ($a, $b) = [1, 2];
>>
>> // I think this new syntax should logically extend to
>>
>> [$a, $b] = [1, 2];
>
> list() and array() are two different language constructs, using the same
> syntax for them is a bad idea.
I tend to agree here but it exists elsewhere and is quite handy. Also
the behavior of this expression, in this case, is obvious.
Cheers,
--
Pierre
@pierrejoye | http://www.libgd.org