Re: [RFC] Arrow functions / short closures
| From: | David Rodrigues | Date: | Thu, 14 Mar 2019 04:01:54 +0000 |
| Subject: | Re: [RFC] Arrow functions / short closures | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104707@lists.php.net to get a copy of this message | ||
I have two doubts about the RFC:
1. Your example with "($x) => $x" consider the use of "$x => $x", but not
specifically "($x) => $x". I mean: maybe it can accept "($x) => $x" but
not
"$x => $x" because of the array conflict (as mentioned), and with that we
avoid to create a new keyword "fn". So parentheses is required.
2. I don't remember. haha
Em qua, 13 de mar de 2019 às 12:57, Nikita Popov <nikita.ppv@gmail.com>
escreveu:
> Hi internals,
>
> Motivated by the recent list comprehensions RFC, I think it's time we took
> another look at short closures:
>
> https://wiki.php.net/rfc/arrow_functions_v2
>
> This is based on a previous (withdrawn) proposal by Levi & Bob. It uses the
> syntax
>
> fn($x) => $x * $multiplier
>
> and implicit by-value variable binding. This example is roughly equivalent
> to:
>
> function($x) use($multiplier) { return $x * $multiplier; }
>
> The RFC contains a detailed discussion of syntax choices and binding modes.
>
> Regards,
> Nikita
>
--
David Rodrigues