Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104712 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 36799 invoked from network); 14 Mar 2019 17:13:39 -0000 Received: from unknown (HELO texthtml.net) (62.210.148.97) by pb1.pair.com with SMTP; 14 Mar 2019 17:13:39 -0000 Received: by texthtml.net (Postfix, from userid 65534) id C58D76A63717; Thu, 14 Mar 2019 15:04:02 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on 365e894fa5b1 X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED autolearn=ham autolearn_force=no version=3.4.1 Received: from cloud.rochette.cc (stunnel_mail_1.mail_default [172.22.0.3]) (Authenticated sender: mathieu@texthtml.net) by texthtml.net (Postfix) with ESMTPA id A94126A63717; Thu, 14 Mar 2019 15:03:56 +0100 (CET) To: PHP internals , Nikita Popov Cc: In-Reply-To: Message-ID: <20190314140356.Horde.DRHws4diCrCqDCSv6NgOSdD@cloud.rochette.cc> User-Agent: Horde Application Framework 5 Date: Thu, 14 Mar 2019 14:03:56 +0000 Content-Type: text/plain; charset=utf-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Arrow functions / short closures From: mathieu@rochette.cc (Mathieu Rochette) References: Hi, it's nice to see this going on again :) while reading the rfc I was wondering, why do we need the "static" keyword, couldn't static function be detected automatically ? I guess this apply to the existing closure syntax as well so to get more on this topic I'll share my preferences on the syntax: I like the ==> or ~> version because it also allow to drop the parenthesis when there is only one argument and it's closer to what I'm used to in javascript I wouldn't mind having the rust syntax too but yeah, it would feel a bit odd in PHP thank you for your work on this ! Nikita Popov – Wed, 13. March 2019 16:57 > Hi internals, > > Motivated by the recent list comprehensions RFC, I think it's time we took > another look at short closures: > > wiki.php.net/rfc/arrow_functions_v2 > > This is based on a previous (withdrawn) proposal by Levi & Bob. It uses the > syntax > > fn($x) => $x * $multiplier > > and implicit by-value variable binding. This example is roughly equivalent > to: > > function($x) use($multiplier) { return $x * $multiplier; } > > The RFC contains a detailed discussion of syntax choices and binding modes. > > Regards, > Nikita