Re: [RFC] Arrow functions / short closures
| From: | Mathieu Rochette | Date: | Thu, 14 Mar 2019 14:03:56 +0000 |
| Subject: | Re: [RFC] Arrow functions / short closures | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104712@lists.php.net to get a copy of this message | ||
Hi,
it's nice to see this going on again :)
while reading the rfc I was wondering, why do we need the "static" keyword, couldn't
static function be detected automatically ?
I guess this apply to the existing closure syntax as well so to get more on this topic I'll
share my preferences on the syntax: I like the ==> or ~> version because it also allow to drop
the parenthesis when there is only one argument and it's closer to what I'm used to in
javascript
I wouldn't mind having the rust syntax too but yeah, it would feel a bit odd in PHP
thank you for your work on this !
Nikita Popov – Wed, 13. March 2019 16:57
> Hi internals,
>
> Motivated by the recent list comprehensions RFC, I think it's time we took
> another look at short closures:
>
> 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