Re: [RFC] Arrow functions / short closures
| From: | Rowan Collins | Date: | Fri, 15 Mar 2019 09:30:32 +0000 |
| Subject: | Re: [RFC] Arrow functions / short closures | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-104732@lists.php.net to get a copy of this message | ||
On Fri, 15 Mar 2019 at 09:01, Alexandru Pătrănescu <drealecs@gmail.com>
wrote:
> My question would be: whatever syntax we are going to use that has arrow
> syntax, let's say *$f = \($x) => $x * 2;* are we going to also support the
> arrow block version?:
> *$f = \($x) => {*
> * // more operations that will have better visible on multi-line*
>
> * return $x * 2;*
> *}*
>
See "Future Scope" in the RFC:
> This feature is omitted in this RFC, because the value-proposition of
this syntax is much smaller: Once you have multiple statements, the
relative overhead of the conventional closure syntax becomes small.
We shouldn't pick a syntax that rules it out, but it can be added later,
with a separate RFC to discuss the benefits and details.
Regards,
--
Rowan Collins
[IMSoP]