Hi Levi,
Levi Morrison wrote:
Here is an example of an existing closure:
function ($x) use ($arr) {
return $arr[$x];
}
This RFC proposes syntax and semantics to simplify this common usage to:
fn($x) => $arr[$x]
Is it necessary to introduce a new keyword, fn?
I think you'd get a similar benefit from:
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/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php