Den 2015-10-03 kl. 01:17, skrev Levi Morrison:
I messaged the list about this feature before I had the RFC written up
for it. The RFC[1] is slightly different from what I proposed in the
previous thread, so please read the RFC to make sure you understand
what is being proposed before replying here.
Here's a small example:
$y = 10;
$result = array_map(function($x) => $x + $y, [1, 2, 3]);
// $result is [11, 12, 13]
Thanks for people who have participated in conversation so far, as
well as those who participated in Bob's short closures proposal as
well.
[1]: https://wiki.php.net/rfc/arrow_functions
Well my comments are:
- By having => as operator we block future idea to remove function
keyword in case limitation in parser is overcome.
- Also suppose one would like to do a simple grep for all anonymous
function in a project, having same as array key will require regexp
search.
- It would also be good is this RFC includes all required text instead
referring to Bob's old one.
- I also misses if default values are supported.
- Not being able to overcome limitation is parser, seems like this RFC
is a compromise for some developers...
- For me as a userland developer I prefer Bob's old proposal but with
added type hints, default values and requiring parenthesis for the
single parameter case.
r//Björn
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php