Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88661 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68986 invoked from network); 4 Oct 2015 10:35:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Oct 2015 10:35:02 -0000 X-Host-Fingerprint: 109.111.195.162 unknown Received: from [109.111.195.162] ([109.111.195.162:14589] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/36-31315-5D001165 for ; Sun, 04 Oct 2015 06:35:01 -0400 Message-ID: To: internals@lists.php.net References: Date: Sun, 4 Oct 2015 11:34:58 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0 SeaMonkey/2.35 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 109.111.195.162 Subject: Re: [RFC] Arrow Functions From: ajf@ajf.me (Andrea Faulds) Hey Levi, Levi Morrison wrote: > I messaged the list about this feature before I had the RFC written up > for it. The RFC[1] is slightly different from what I proposed in the > previous thread, so please read the RFC to make sure you understand > what is being proposed before replying here. > > Here's a small example: > > $y = 10; > $result = array_map(function($x) => $x + $y, [1, 2, 3]); > > // $result is [11, 12, 13] As I've said elsewhere, I quite like this syntax. There's no weird new operator to learn, for starters. The use of the existing keyword means it's more obvious to unfamiliar PHP users what it is, and it's "Googleable". Yet the syntax is still significantly less verbose than before, so it's still helpful. I'd particularly like it if we could use this syntax for methods, as has been suggested under future scope. It'd slim down "getter" methods quite a bit. Do you think you could do that as a separate vote within the RFC, alongside the main one? That makes it easier for it to get in than having to create a wholly separate RFC for something that's quite a small change. Thanks! -- Andrea Faulds http://ajf.me/