Re: RFC proposal for alternative list syntax
| From: | Julian Rhind | Date: | Thu, 14 Jan 2016 17:20:33 +0000 |
| Subject: | Re: RFC proposal for alternative list syntax | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-90646@lists.php.net to get a copy of this message | ||
Hi
Thanks all for the feedback - I'm posting back to get some "RFC karma" for my newly
created wiki account please - so I can post my RFC - username is "julian"
Thanks
Regards
Julian
________________________________
From: Kris Craig <kris.craig@gmail.com>
Sent: 28 December 2015 18:40
To: Pierre Joye
Cc: PHP internals list; Julian Rhind; Stanislav Malyshev
Subject: Re: [PHP-DEV] RFC proposal for alternative list syntax
On Dec 27, 2015 7:56 PM, "Pierre Joye" <pierre.php@gmail.com<mailto:pierre.php@gmail.com>> wrote:
>
> On Mon, Dec 28, 2015 at 6:20 AM, Stanislav Malyshev
> <smalyshev@gmail.com<mailto: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
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
This could be very nice shortcut to have. Seems intuitive enough; I doubt there'd be any
serious confusion over this.
You should draft an RFC for this, OP.
--Kris