Hey Levi,
Levi Morrison wrote:
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]
As I've said elsewhere, I quite like this syntax. There's no weird new
operator to learn, for starters. The use of the existing keyword means
it's more obvious to unfamiliar PHP users what it is, and it's
"Googleable". Yet the syntax is still significantly less verbose than
before, so it's still helpful.
I'd particularly like it if we could use this syntax for methods, as has
been suggested under future scope. It'd slim down "getter" methods quite
a bit. Do you think you could do that as a separate vote within the RFC,
alongside the main one? That makes it easier for it to get in than
having to create a wholly separate RFC for something that's quite a
small change.
Thanks!
--
Andrea Faulds
http://ajf.me/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php