AW: [PHP-DEV] RFC proposal for alternative list syntax
| From: | Robert Stoll | Date: | Sun, 27 Dec 2015 23:36:44 +0000 |
| Subject: | AW: [PHP-DEV] RFC proposal for alternative list syntax | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-89903@lists.php.net to get a copy of this message | ||
Hi,
> -----Ursprüngliche Nachricht-----
> Von: Stanislav Malyshev [mailto:smalyshev@gmail.com]
> Gesendet: Montag, 28. Dezember 2015 00:21
> An: Julian Rhind; internals@lists.php.net
> Betreff: Re: [PHP-DEV] RFC proposal for alternative list syntax
>
> 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.
>
> --
> Stas Malyshev
> smalyshev@gmail.com
>
> --
> PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:
> http://www.php.net/unsub.php
To me it looks pretty much like pattern matching and I would like to see pattern matching in PHP.
Maybe we need to add a
little bit more syntax to distinguish it from normal array usage but I like the idea.