Re: [RFC][Discuss] Arrow Functions
| From: | Christoph M. Becker | Date: | Tue, 31 Jan 2017 18:41:27 +0000 |
| Subject: | Re: [RFC][Discuss] Arrow Functions | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98088@lists.php.net to get a copy of this message | ||
On 31.01.2017 at 19:16, Michael Morris wrote:
> On Tue, Jan 31, 2017 at 12:29 PM, Larry Garfield <larry@garfieldtech.com>
> wrote:
>
>> My question is why there's no mention of HHVM short closures, or the
>> previous RFC to take that approach. See:
>>
>> https://docs.hhvm.com/hack/lambdas/introduction
>
> For what it's worth I'd rather look at
>
> array_map( $x ==> $x + 1);
>
> than
>
> array_map( fn($x) => $x + 1 )
>
> Not to mention the former isn't a bc break.
Neither is supposed to work, though. :)
Anyhow, I'm not sure whether I'd prefer
array_map($a, $b, $c ==> $a + $b + $c, $a1, $a2, $a3)
over
array_map(fn($a, $b, $c) => $a + $b + $c, $a1, $a2, $a3)
or maybe
array_map(fn $a, $b, $c => $a + $b + $c, $a1, $a2, $a3)
Somehow, I tend to like a trailing keyword for better left-to-right
readability.
--
Christoph M. Becker