Re: [RFC][Discuss] Arrow Functions
| From: | Andrea Faulds | Date: | Tue, 31 Jan 2017 01:12:07 +0000 |
| Subject: | Re: [RFC][Discuss] Arrow Functions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98059@lists.php.net to get a copy of this message | ||
Hi Levi,
Levi Morrison wrote:
Here is an example of an existing closure:Is it necessary to introduce a new keyword, fn? I think you'd get a similar benefit from:function ($x) use ($arr) { return $arr[$x]; }This RFC proposes syntax and semantics to simplify this common usage to:fn($x) => $arr[$x]
function($x) => $arr[$x]Likewise, is it necessary to restrict auto-capture to the => syntax? Couldn't we allow the following?
function ($x) {
return $arr[$x];
}
That being said, I broadly support your goals.
--
Andrea Faulds
https://ajf.me/