Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88500 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48218 invoked from network); 25 Sep 2015 19:44:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Sep 2015 19:44:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=bishop.bettini@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bishop.bettini@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.176 as permitted sender) X-PHP-List-Original-Sender: bishop.bettini@gmail.com X-Host-Fingerprint: 209.85.212.176 mail-wi0-f176.google.com Received: from [209.85.212.176] ([209.85.212.176:37144] helo=mail-wi0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CF/16-31991-A24A5065 for ; Fri, 25 Sep 2015 15:44:43 -0400 Received: by wicfx3 with SMTP id fx3so32578218wic.0 for ; Fri, 25 Sep 2015 12:44:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=VjULiSLcxHKT2EGfq9cfGdQwX/jaJ3aWVHvEHhsOHJY=; b=IDSCJRQcUUcyOH69A1LlAN7oGb9Yw/R9hTr/ND+qCqErdx+o7oeDFUZkKztgdbd82J HceU1c4Aj/fiGroT6Jx8xd1Jr5pSJ2FaXzTz+JkhTwBs2yzRsmUFA2MN3UPuQBZ8Kafl gYxCcDfunk0M36TfK4NLxCaKAYvZiprgbV+POBjl0nVJE3Ty780jEwF8iMy0jQFf9WeE QZqvRjG1r90ccU5/XwGLeeFWhl2pZS2CPGAbzSHV4taHkvX8ZZ6+D5KTKQiRl6jeudec pZ6+6z8zw6IOylfy4aieoc4VlfjUQD9oImy57xyX4uJ7M5SANoOgSN0H3jgKvBgztfvQ eXeg== MIME-Version: 1.0 X-Received: by 10.194.235.6 with SMTP id ui6mr9486995wjc.92.1443210278906; Fri, 25 Sep 2015 12:44:38 -0700 (PDT) Reply-To: bishop@php.net Sender: bishop.bettini@gmail.com Received: by 10.194.110.72 with HTTP; Fri, 25 Sep 2015 12:44:38 -0700 (PDT) In-Reply-To: References: Date: Fri, 25 Sep 2015 15:44:38 -0400 X-Google-Sender-Auth: _Pkad98rlnamxqKxakYWoEYke-M Message-ID: To: Bob Weinand Cc: PHP internals Content-Type: multipart/alternative; boundary=089e01493bd002b1aa05209794fa Subject: Re: [PHP-DEV] [RFC] [VOTE] Short Closures From: bishop@php.net (Bishop Bettini) --089e01493bd002b1aa05209794fa Content-Type: text/plain; charset=UTF-8 Hi, On Mon, Sep 21, 2015 at 9:59 PM, Bob Weinand wrote: > So, before I start the vote, just two quick notes: > I've added two notes about the statement syntax and the single variable > use. > Though a few people complained, I'm not switching to the ==> operator, as > I noticed many people expected typehints to work (they don't due to parser > limitations) when they compared to Hack's short Closures. It also allows us > to differ syntax-wise [e.g. for typehints] from Hack without causing any > confusion later. Which should be the smartest choice: Avoid conflicts. (If > anyone strongly feels against that, he may vote no, but I would like to not > bikeshed that in this Vote thread, but leave it free for eventual actual > issues.) > I voted "no" because I'm against the automatic use () and introducing a new symbol. An earlier short closure RFC [1] supports explicit import, and I would want to see explicit import mandated. And rather than inventing a new symbol, why not just re-purpose 'as' in this context? function sumEventScores($events, $scores) { $types = array_map($event as $event['type'], $events); return array_reduce($types, ($sum, $type) as $sum + $scores[$type]); } 'use' is already purposed in three places, I don't see why 'as' can't also be in three places. Though I've not checked the engine source to see the actual effort, so this just may be astronaut architecting. Anyway, thanks to Bob for his hard work pulling this together and everyone for arguing it out. That's what makes PHP great. Sincerely, bishop [1]: https://wiki.php.net/rfc/short-syntax-for-anonymous-function --089e01493bd002b1aa05209794fa--