Hi,

David Walker wrote:
On Mon, Jan 30, 2017 at 18:12 Andrea Faulds <a...@ajf.me> wrote:

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];
     }


This looks too similar to the current syntax, just ignoring the use()
statement.

That's the idea. I'd prefer it if auto-capture was not restricted to single-expression functions (“arrow functions”). Though arrow functions make most sense with auto-capture, it doesn't need to be stricted to them.

Thanks.

--
Andrea Faulds
https://ajf.me/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to