Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98136 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64760 invoked from network); 3 Feb 2017 17:48:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2017 17:48:52 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.47 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.215.47 mail-lf0-f47.google.com Received: from [209.85.215.47] ([209.85.215.47:34531] helo=mail-lf0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DB/13-38491-182C4985 for ; Fri, 03 Feb 2017 12:48:50 -0500 Received: by mail-lf0-f47.google.com with SMTP id v186so14040250lfa.1 for ; Fri, 03 Feb 2017 09:48:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=IhFBCh8OxmTxTi/uwVn+KJCU7awM39k5jHAls9d7H2I=; b=tBUj9YWq90K2SO2AtuhzCDL4/g+tUQNAz0jiX5jn7ykqrAmtWrCtW+rLXw9V7cZ5Db nobDp302oDHZBYM4Wqyd2WMTu03KAaicOugJZLUa3vZtovqPGk2hhkgshSLuLiXj3PX7 MfPcsBOj/kefs7LmODVtiDq3DYQ4ikJ4CxRfz5sy49QAhFN50n+iFLP0XHX3Y5Mucxd5 GJWe9FYjbs6+i2gyBzuJgOsz2l/gu5W8zTGoPNEVokkJP+TCMkm2K/HamRWaWbGh30/J 1o/PPJQQAx/+/i6e2x8HsiEzHRZZryaqub6zP6rdVcrQFhirYPyQV4hgNb7fxaYzTCE0 5Knw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=IhFBCh8OxmTxTi/uwVn+KJCU7awM39k5jHAls9d7H2I=; b=f7B+4AOQlFRvrcY3f4TfEKJ8iRrnTVN5Z9kU2yrAZnECqmNl/6fW78Qe2NPnOmso4Z B3RpalctA/1G9cL47z+8Z/N5Ged+HbYolmiM2u97ux3S7THn55++oQeM4C+O/OQdBaDE dbAi0149iqeDq4X/7pEJ2yVlt+fALOLHSW9rKi9X5SmCit6x5sZH8zt9KNwqy6MXypFn T5MS0+zNOf1TLzQftUm8GwXQTgHenejWvJV8C6WdePqPnFb6G7IHTFvjh12W4ATS/+sX 7AuBAg11lL9BEC35X1LU1WrL1tKmqVcq5hVcdP2vtmaEFA7rcjaO3In8DxgWM5TXmAo+ oTMA== X-Gm-Message-State: AIkVDXKtrj7NFviMNMgpUf/UNeo3xsvpNcLTGs6rPL3TQ6qW2EaT5UTzAng/fzRMiO8vJ31YxZKFMSGPePcxKg== X-Received: by 10.25.75.79 with SMTP id y76mr5806893lfa.143.1486144126433; Fri, 03 Feb 2017 09:48:46 -0800 (PST) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.25.151.139 with HTTP; Fri, 3 Feb 2017 09:48:45 -0800 (PST) In-Reply-To: References: Date: Fri, 3 Feb 2017 10:48:45 -0700 X-Google-Sender-Auth: wMv-8oJ95WfZCrmthdT__aSMTm0 Message-ID: To: internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [RFC][Discuss] Arrow Functions From: levim@php.net (Levi Morrison) On Mon, Jan 30, 2017 at 10:55 AM, Levi Morrison wrote: > Bob Weinand and I are happy to announce that the [Arrow Functions][1] > RFC is moving into the public discussion phase. We have been > collaborating on this RFC for many months now and finally have a > proposal we are happy to discuss in the open. > > Here is an example of an existing closure: > > function ($x) use ($arr) { > return $arr[$x]; > } > > This RFC proposes syntax and semantics to simplify this common usage to: > > fn($x) => $arr[$x] > > More details are in the RFC. The [implementation][2] currently has no > known issues and is ready for you to download, build and test, which > we encourage you to do. > > We look forward to a productive discussion period and are happy to > answer questions. > > For historical purposes, the revision of this RFC is currently at > [1485798604][3]. > > [1]: https://wiki.php.net/rfc/arrow_functions > [2]: https://github.com/morrisonlevi/php-src/tree/arrow_functions > [3]: https://wiki.php.net/rfc/arrow_functions?rev=1485798604 Thanks to everyone who has participated in the discussion thus far. Primarily the feedback has been directed at the `fn` keyword. Let me provide two benefits and drawbacks of using `fn` as a keyword: 1. `fn` is searchable in search engines and in our manual 2. Is more intuitive than just syntax However, `fn` does have downsides: 1. Can break existing code 2. We already have a similar keyword `function` To that end, I'd like to gauge interest in a pure syntax based alternative that is similar to Rust and Ruby. Instead of: fn(params) => expr What about: |params| => expr This trades the advantages of the keyword for the advantages of pure syntax, and happens to be two characters shorter. To be explicit: 1. Preserves 100% backwards compatibility 2. Avoids having two keywords that both mean "function" 3. Is not easily searchable in engines or in the manual 4. Is a tad bit shorter What do you think, Internals?