Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98086 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 22355 invoked from network); 31 Jan 2017 18:34:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2017 18:34:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.43 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.215.43 mail-lf0-f43.google.com Received: from [209.85.215.43] ([209.85.215.43:36739] helo=mail-lf0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 29/09-51557-8A8D0985 for ; Tue, 31 Jan 2017 13:34:17 -0500 Received: by mail-lf0-f43.google.com with SMTP id z134so216137379lff.3 for ; Tue, 31 Jan 2017 10:34:16 -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=VQECGikUT2MHlAImvWqSFKHTaKBwQJwd079G75gPQH4=; b=kr29h7QebLi/hA22M4odon5Ff8KC9QKqEvP7qsh0Aa2y2z9KI9VSy5RNmIOqD9XftQ 6fuji12jdS8nxMcucMKOj1fh22Ix8gqrXxp1ThsWsr2MtTq9aRVL2SLAy8eDkU585PDN Icxg6eH3jkqbyWrzoBiXU1MVJ0HCIEQGBBkE3vRv7aou9aimOL23PlQNKc+I02ildvrr HDa/w3yyYDLzhJI+YGRHNU6HxNrJmkMLxkqAm4zbJze8oPoFkWIF0l4+V3yAvBb0QI6l Oy/LE8A6wjIhYEfXr1+2nuxPJQrCCk+oag9bmzCte4SE9COH9bakXfBUnVMkhfHDpgPa LDpg== 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=VQECGikUT2MHlAImvWqSFKHTaKBwQJwd079G75gPQH4=; b=JBhlpxUWzIASfqdVAJprYr51bzrL9xtf+5NHEwbsiebhhdl41BbIpsk0VW1wQNzgtK Ro4D1HWGlzJFeIybkOrAp5fQB0G7k8l9SlZu/fa2wDudU2Et5FrpkOYCKgJdLe01DueA sEhcPk6CU8tmPGhLvjqbfi9hON03LVdLz8aDw0G5We0LG8RzE1F3ucYoFBMNKxnskScJ ff/7A1J2YOmGjUfW7kjO2u3OxvyoYc6UrQvsmmNR7GMurnFBda84EZMCq+tNpNn8hJ8J CF8uIiD9C/8RINGL8Cy+zPRCp861qPQ2pf8f849gDt7bot5eF9z0qLQt1QClQKjuPEfq MqBw== X-Gm-Message-State: AIkVDXKlsPdBA6E257fZLAuZKzrfS/vQrz5TNfTU25rTA6HaRRv7IUMktfdIJpXB2HW1TFXXggjBI1on+EfwAA== X-Received: by 10.25.25.133 with SMTP id 127mr9573683lfz.153.1485887653355; Tue, 31 Jan 2017 10:34:13 -0800 (PST) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.25.151.139 with HTTP; Tue, 31 Jan 2017 10:34:12 -0800 (PST) In-Reply-To: References: Date: Tue, 31 Jan 2017 11:34:12 -0700 X-Google-Sender-Auth: -biAUkqvAh7qr6sGOO9EYBCUu_o 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 Thank you to everyone who has participated in the discussion so far. Several people have asked for examples of type declarations. I have updated the RFC accordingly and also added an example for by-ref parameters and returns. Here are the examples: fn (array $x) => $x fn (): int => 42 fn &(array &$xs) => $xs I have also made some minor improvements to the formatting in various places.