Re: Re: [RFC][Discuss] Arrow Functions

From: 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:
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/

« previous php.internals (#98090) next »