Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98059 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47395 invoked from network); 31 Jan 2017 01:12:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2017 01:12:11 -0000 X-Host-Fingerprint: 95.144.152.174 unknown Received: from [95.144.152.174] ([95.144.152.174:8427] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E6/ED-51557-B64EF885 for ; Mon, 30 Jan 2017 20:12:11 -0500 Message-ID: To: internals@lists.php.net References: Date: Tue, 31 Jan 2017 01:12:07 +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: 7bit X-Posted-By: 95.144.152.174 Subject: Re: [RFC][Discuss] Arrow Functions From: ajf@ajf.me (Andrea Faulds) Hi Levi, Levi Morrison wrote: > Here is an example of an existing closure: > > function ($x) use ($arr) { > return $arr[$x]; > } > > This RFC proposes syntax and semantics to simplify this common usage to: > > fn($x) => $arr[$x] > 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]; } That being said, I broadly support your goals. -- Andrea Faulds https://ajf.me/