Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88518 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32674 invoked from network); 26 Sep 2015 18:37:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Sep 2015 18:37:37 -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.213.53 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.213.53 mail-vk0-f53.google.com Received: from [209.85.213.53] ([209.85.213.53:36578] helo=mail-vk0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/03-06395-0F5E6065 for ; Sat, 26 Sep 2015 14:37:36 -0400 Received: by vkfp126 with SMTP id p126so72428809vkf.3 for ; Sat, 26 Sep 2015 11:37:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=jgqszz5obcohe9obBZilwE9RvLAsLNE6k7KI7gUIHow=; b=dLFpjBaEh+PriBy4eHk5P/M/lJfxRreU4CA2AELowLDkWyvMOyCb/TL0RHoHJ5DyG1 EQV4st1QLAyYbpFLIgAV1A/4Uq/UFqGBCz/MUu6O4FVyqwZtlSwOpyW57CEh0jg1Qsdk wv4pSneRtxVuQaApEpfomilfjgmayIn+kxaNrmOgg/O6yAh6FbLMsuNccwAC6i5m+eyE J/k5SJAcAT6V74tXyThN7nNKb+e/aRa1yiCj+ShFyjvKJh2LkbXiWo79I9NcB0mquCaE EPkIpH2uB8WBGmVV3BSlHwQLBGPQSDD7NpfmuH/d047Eq+q40SOd0stkpG1EUajVLEqt LDFA== MIME-Version: 1.0 X-Received: by 10.31.163.75 with SMTP id m72mr7403786vke.54.1443292653099; Sat, 26 Sep 2015 11:37:33 -0700 (PDT) Sender: morrison.levi@gmail.com Received: by 10.31.41.205 with HTTP; Sat, 26 Sep 2015 11:37:33 -0700 (PDT) In-Reply-To: References: <5606D0EB.3060106@gmail.com> Date: Sat, 26 Sep 2015 12:37:33 -0600 X-Google-Sender-Auth: Re65nt63BptM6rw1LJkwGByfD_0 Message-ID: To: Rowan Collins Cc: internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Arrow function expressions in PHP From: levim@php.net (Levi Morrison) On Sat, Sep 26, 2015 at 12:31 PM, Levi Morrison wrote: > On Sat, Sep 26, 2015 at 11:07 AM, Rowan Collins = wrote: >> On 26/09/2015 17:17, Levi Morrison wrote: >>> >>> What concerns do you have about `fn($x) =3D> $x * 2` or `function($x) = =3D> >>> $x * 2`? I will be writing a proper RFC later but I wanted to get >>> discussion going now. >> >> >> If a keyword is required next to the parameters, having the =3D> as a se= parate >> token looks a bit weird. It no longer matches other languages, so how ab= out >> thinking a bit further outside the box? > > Thank you for the feedback. I feel like the rest of what you proposed > was a bit too far outside of the box. For what it is worth no token > after the paren is necessary =E2=80=93 you could do `fn($x) $x * 2` (or > `function($x) $x * 2`). I think this is a case where more syntax > helps. Here they are on separate lines so you can see things more clearly: $output =3D array_map(function($x) $x * 2, $input); $output =3D array_map(function($x) =3D> $x * 2, $input); I think the arrow helps.