Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88580 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25249 invoked from network); 30 Sep 2015 14:49:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Sep 2015 14:49:43 -0000 Authentication-Results: pb1.pair.com header.from=marcio.web2@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=marcio.web2@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.179 as permitted sender) X-PHP-List-Original-Sender: marcio.web2@gmail.com X-Host-Fingerprint: 209.85.160.179 mail-yk0-f179.google.com Received: from [209.85.160.179] ([209.85.160.179:36421] helo=mail-yk0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/00-24989-686FB065 for ; Wed, 30 Sep 2015 10:49:43 -0400 Received: by ykdt18 with SMTP id t18so46105570ykd.3 for ; Wed, 30 Sep 2015 07:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=zd/3RNf9AwNEgXXdQ3OhTZ9+lHqpxzl4rIzRzYx6b4g=; b=GDq95Olp38+jbJXFe5uToqlpIucH6DpJY60xdPqxzL2fdhbv+g3anan3OPPIZbJvTM an/IkpMmWEmS87RChafbHVrgXujtEM9PRIHlW6/0d/thBbImaFMQxJfCJQO5c45Va4/6 AAt+vfHCGODarbjw5ZSLUxAGumvlbBXjHMqWMYXJxpqfqXPfvkOvBwAHW/Y6CMg7GRhy fJkRUsLti1q+qk9jHsL+qUwmt64yL1hRVUgnpGXsrCenw7nPFw/ES36hYkq7kXzv9oBd JTQ/tbUdE588AmvCY+WOvEZo5sHH5J1sHi/Swt7hV7+lqnAlswBbFADThCmzPy1donWR rRdQ== X-Received: by 10.13.203.200 with SMTP id n191mr1413240ywd.59.1443624578015; Wed, 30 Sep 2015 07:49:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.197.195 with HTTP; Wed, 30 Sep 2015 07:49:18 -0700 (PDT) In-Reply-To: <560BC324.7010901@gmail.com> References: <560BC324.7010901@gmail.com> Date: Wed, 30 Sep 2015 11:49:18 -0300 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Arrow function expressions in PHP From: marcio.web2@gmail.com (Marcio Almada) Hi, 2015-09-30 8:10 GMT-03:00 Rowan Collins : > Levi Morrison wrote on 29/09/2015 22:55: >>> >>> When you choose the function($x) ~> $x * 2 (or with ==> or => >>> >operator), you end up saving around 5 or 6 characters from the "long >>> >declaration", ending up with "not-so-short closures" instead. You save >>> >a little bit more if you have the implicit "use", but that's one thing >>> >people are torn about, by looking at the discussion about the RFC, but >>> >I think it's too long, for "short closures". >> >> Reading over the list I don't think people "are torn about" it. There >> are some detractors, sure, but there seem to be more detractors about >> symbol choice (~) and lack of type declarations. > > > On a quick glance through the list I gathered the following names expressing > disapproval of the automatic capture (apologies if I've misrepresented > anyone's opinion here, it was a very quick skim through!): > > Dmitry > Rasmus > Peter Petermann > Bishop Bettini > Stas > Ferenc > Thomas Punt > > Plus a couple of other people on the fence on the issue (as am I): > Marco Pivetta: "I am still conflicted..." > Arne Blankerts: "I can see the benefit ... but consider it a break of > concepts (habit?) from everywhere else in PHP." > > > That seems like a significant proportion of the people actively > participating in the thread to me; as mentioned elsewhere, there are more > people who've voted no than have expressed their reasons on the list, and > it's a mug's game to guess which factors influence whom. Also, remember that > the votes on RFCs are intended to confirm consensus, not replace it - the > idea is not to win over just enough people to "win", so it's not necessarily > about numbers. > > That's not to say that automatic capture is an absolute blocker, but I think > "the internals community is divided on it" is a reasonable summary. > That's the part I couldn't comprehend in the discussion. Auto import is basically the most interesting reason to have short closures on PHP. Apart from syntax sugar which, could be nice but, on it's own wouldn't be as important to most people. > Regards, > -- > Rowan Collins > [IMSoP] I abstained from voting on Bob's proposal because of the syntax choice ~> and because of the lack of types support. With that said, I think Levi's proposal is more complete without hurting our current expectations regarding deterministic parsing. Levi's proposal also open doors for a short method declaration as "fn" could become interchangeable with "function" (if we choose to propose the "fn" prefix). I still have a personal preference for the '==>' because it *looks* less ambiguous on the array edge case '[fn($x) => $x * 2]' vs '[fn($x) ==> $x * 2]', and of course because it is more efficient to grep. But that preference wouldn't be enough for me to reject the RFC with '=>'. Ty, Marcio