Re: [RFC][Discuss] Arrow Functions
| From: | Niklas Keller | Date: | Tue, 31 Jan 2017 13:03:37 +0000 |
| Subject: | Re: [RFC][Discuss] Arrow Functions | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98079@lists.php.net to get a copy of this message | ||
Nicolas Grekas <nicolas.grekas+php@gmail.com> schrieb am Di., 31. Jan.
2017, 13:45:
> >
> > As noted in the RFC, this isn't possible due to ambiguities with array
> > keys and yield expressions with keys.
> >
>
> There are not ambiguities technically, so it is possible if we want to:
>
> $a = [
> $y => 'b',
> ($x) => $x + 1, // key, value pair
> ];
>
> $a = [
> $y => 'b',
> (($x) => $x + 1), // closure
> ];
>
Well, it is ambiguous. Your solution just arbitrarily resolves it to one of
them.
But as far as I know there are more problems like supporting types that
make it quite complicated with that syntax.
Regards, Niklas
>