Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99560 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14400 invoked from network); 19 Jun 2017 19:43:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jun 2017 19:43:54 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@mindplay.dk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@mindplay.dk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mindplay.dk from 74.125.83.53 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 74.125.83.53 mail-pg0-f53.google.com Received: from [74.125.83.53] ([74.125.83.53:36696] helo=mail-pg0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0C/8B-13828-77928495 for ; Mon, 19 Jun 2017 15:43:53 -0400 Received: by mail-pg0-f53.google.com with SMTP id u62so33215916pgb.3 for ; Mon, 19 Jun 2017 12:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=vwV1uXnC+yLAc9qKOEqIwWueIb4o8DyBwNJjtXjYahg=; b=JfbIIinpnuIa7Ydn7iJ18Sein8uUjwmWY5UG8gQRa8qhYzMLiy3obxLeWk79VaGl/H 85KWtXyHUzkQrA1Snh820ywz1r1uWsB4OuZ9PH8Sh1U8gnl2IzrN2w+JQqGYnWZD3AsC gliR0iAJEuPY8x+/XhDHefGP/MS82jyYmabiKl+dtiXr+PaXbI7wVvaWXLPefqdjsRbW JsuAY6FKSxnp1xdIfS2ddUTWZ1TPBxDFIR9y2ajxJFZfhRVlYycpukqDNqBxgzJayMib +47822YqjFs4OcNJnimOC9IvtEK7cD9W4RB+7mVj4h7kS8oCiw/q+2MvyOPPwa3i1gm1 cGvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=vwV1uXnC+yLAc9qKOEqIwWueIb4o8DyBwNJjtXjYahg=; b=O0kvWzeZcyGMTnSHVqMbbx4Y/qhiprXO+eGDySvA5E/hXb5fyVEtGZSYK2U2k/2pvm Jba5KWg/OTXCRCAEwiCLzFhatjps7k2tuIOw9INYfDauk3bdo5fy7FGTIV8ptV8ilobS DGQnGISR7u6QS/kfBMoVzmkBnI70kKVyWA3PwNwSHn81TGQymS9AZkkbGOct0cmSS77L h3weAbnzqgrWkdWt4u5qzwP9XAWE2X6U/ZFM6bxIOUPGueEDDDy1tKU244rf64esU68O cueIWZ9V+GIHbF1SOve4S5BvwbDm0+cpVUD/1/d3XLD4qOKqEFrK/PK/TRBYL2yKYnXM 3hkg== X-Gm-Message-State: AKS2vOxlq4igZbXa61vjhtGsC1ziGL6mJfwrCX8QsTVMP0JIpDFxBv4K HXMAUOk9icRjn/PtkRyGzHmBYnPxp4qX X-Received: by 10.98.103.134 with SMTP id t6mr26582162pfj.83.1497901427992; Mon, 19 Jun 2017 12:43:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.151.167 with HTTP; Mon, 19 Jun 2017 12:43:47 -0700 (PDT) In-Reply-To: References: <4077c099-2247-c3c1-7dee-02a6b25f8586@fleshgrinder.com> <559b73f7-c40f-e593-f0e1-51b56210d7cb@telia.com> <2053A608-6B66-42FB-A6D7-7CC64E94DA6A@koalephant.com> <4FBDE643-1EBC-485A-A39F-7E28C5D4807A@koalephant.com> <034f3ebf-95b8-a7cf-1279-77c7cf0424d7@gmail.com> <46143e7c-ef75-7c05-eaa9-98c8f3b405f1@telia.com> <5fe1eefe-1c4f-4c31-c975-ab6c768c977c@telia.com> <3C763609-54FC-480B-AE95-94A1873226E0@me.com> <9A3447BF-F982-4C5A-B55B-466036AF2E53@me.com> Date: Mon, 19 Jun 2017 21:43:47 +0200 Message-ID: To: Levi Morrison Cc: Ilija Tovilo , =?UTF-8?Q?Bj=C3=B6rn_Larsson?= , Fleshgrinder , PHP internals Content-Type: multipart/alternative; boundary="001a1137111a8641130552555a45" Subject: Re: [PHP-DEV] [RFC]Discuss] Syntax for Arrow Functions From: rasmus@mindplay.dk (Rasmus Schultz) --001a1137111a8641130552555a45 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I actually like this syntax, but what would it look like for multi-statement closures? A nested set of curly braces around the body would look pretty messy. $things->forEach({$v =3D> { foo($v); bar($v); }}); On Mon, Jun 19, 2017 at 4:43 PM, Levi Morrison wrote: > On Sun, Jun 18, 2017 at 1:44 PM, Ilija Tovilo wrote= : > > Sorry, I wasn=E2=80=99t aware of that. > > > > What do you think of the Ruby/Rust style syntax that Levi proposed a > while back? > > > > $someDict > > ->map(|$v| $v * 2) > > ->filter(|$v| $v % 3); > > > > This one has a few advantages: > > > > 1. It has syntax (a lot of) developers are already familiar with > > 2. It has no ambiguities and is fully backward compatible > > 3. It=E2=80=99s the shortest of all options available (two `|` characte= rs and > one space) > > We determined that the arrow between the parameters and the expression > would still be required. Given this limitation I think this syntax is > seviceable: > > $someDict > ->map({$v =3D> $v * 2}) > ->filter({$v =3D> $v % 3}); > > Sometime this week I intend to start another thread that narrows us > down to two choices. > --001a1137111a8641130552555a45--