Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98090 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32948 invoked from network); 31 Jan 2017 20:41:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2017 20:41:14 -0000 X-Host-Fingerprint: 137.50.184.77 oa-edu-184-77.wireless.abdn.ac.uk Received: from [137.50.184.77] ([137.50.184.77:22820] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/BA-51557-966F0985 for ; Tue, 31 Jan 2017 15:41:13 -0500 Message-ID: <1E.BA.51557.966F0985@pb1.pair.com> To: internals@lists.php.net References: Date: Tue, 31 Jan 2017 20:41:09 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 137.50.184.77 Subject: Re: [PHP-DEV] Re: [RFC][Discuss] Arrow Functions From: ajf@ajf.me (Andrea Faulds) Hi, David Walker wrote: > On Mon, Jan 30, 2017 at 18:12 Andrea Faulds 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/