Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88836 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65034 invoked from network); 15 Oct 2015 19:50:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Oct 2015 19:50:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=bjorn.x.larsson@telia.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=bjorn.x.larsson@telia.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain telia.com from 81.236.60.155 cause and error) X-PHP-List-Original-Sender: bjorn.x.larsson@telia.com X-Host-Fingerprint: 81.236.60.155 v-smtpout2.han.skanova.net Received: from [81.236.60.155] ([81.236.60.155:52288] helo=v-smtpout2.han.skanova.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2E/AC-23021-B6300265 for ; Thu, 15 Oct 2015 15:50:04 -0400 Received: from [192.168.7.4] ([195.198.188.252]) by cmsmtp with SMTP id moXIZNFjcaiRLmoXIZdHAu; Thu, 15 Oct 2015 21:50:00 +0200 To: Levi Morrison References: Cc: PHP internals Message-ID: <56200368.7070308@telia.com> Date: Thu, 15 Oct 2015 21:50:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfAK6DUFC5Mn3KUQ+cOvlzO9ErZbKrFTr5ILSLeI5D3vFedYvqRlfhayDszD6n9X2zYxsOub0wPjlFmE6bnUzB91wsVtAN6AgDIYCh+RV9b5dYcQFWenUdIwqGc6exWfOIkY3G3QekX2frhq+o2/AAbIwsEBCTUNHGvE1mCxrwEXB1w8KEZ45QwRMcExgivaDb1CdYumelNrfrxu74rlvK3kKMahItbNXMYgFpto1i8S2 Subject: Re: [PHP-DEV] [RFC] Arrow Functions From: bjorn.x.larsson@telia.com (=?UTF-8?Q?Bj=c3=b6rn_Larsson?=) Den 2015-10-03 kl. 01:17, skrev Levi Morrison: > 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] > > Thanks for people who have participated in conversation so far, as > well as those who participated in Bob's short closures proposal as > well. > > [1]: https://wiki.php.net/rfc/arrow_functions > Well my comments are: - By having => as operator we block future idea to remove function keyword in case limitation in parser is overcome. - Also suppose one would like to do a simple grep for all anonymous function in a project, having same as array key will require regexp search. - It would also be good is this RFC includes all required text instead referring to Bob's old one. - I also misses if default values are supported. - Not being able to overcome limitation is parser, seems like this RFC is a compromise for some developers... - For me as a userland developer I prefer Bob's old proposal but with added type hints, default values and requiring parenthesis for the single parameter case. r//Björn