Re: Re: [RFC][Discuss] Arrow Functions
| From: | Andrea Faulds | Date: | Tue, 31 Jan 2017 20:41:09 +0000 |
| Subject: | Re: Re: [RFC][Discuss] Arrow Functions | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98090@lists.php.net to get a copy of this message | ||
Hi,
David Walker wrote:
On Mon, Jan 30, 2017 at 18:12 Andrea Faulds <ajf@ajf.me> wrote: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/Is it necessary to introduce a new keyword, fn? I think you'd get a similar benefit from:This looks too similar to the current syntax, just ignoring the use() statement.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]; }