Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99561 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15801 invoked from network); 19 Jun 2017 19:45:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jun 2017 19:45:33 -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 209.85.192.180 cause and error) X-PHP-List-Original-Sender: rasmus@mindplay.dk X-Host-Fingerprint: 209.85.192.180 mail-pf0-f180.google.com Received: from [209.85.192.180] ([209.85.192.180:35911] helo=mail-pf0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/DB-13828-CD928495 for ; Mon, 19 Jun 2017 15:45:33 -0400 Received: by mail-pf0-f180.google.com with SMTP id x63so58310831pff.3 for ; Mon, 19 Jun 2017 12:45:32 -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=5/3nPXvUhe0pgrC7C29q0zuxPZDl+0EWBlbkqFYBwno=; b=TJtuIitUw9+i0Tq0iyz6Ho2Ynpc0ksq9vENMO8PzG0oT2EcBVlMxrkaRDXKVp+2WXo yl/f46fMMszSRFwdPvVepJ+/TMESFnRgKQuE7Uqo/Xb+AqBiZ+SnLpbwalBfGUKElabR KCR+/ODeqBfB/3SxIwMqxi8dP2cdvkgBA4l3VijniUzKSTXYamjqtj+6FOSSPkiP5UWn 7Z14Mpb0Ud/lASzEyCbisk2XG/vG8Em4JUs1HY5H0cJEUUl7aNtthsXYRAxkjYY3fQ/a Z0olGNp5df/W+0yA/OvwDkPtH5bC+b1ArLnyuPbewwD8zgJNo3pI5LkLUpqwFKByK0Et ir2A== 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=5/3nPXvUhe0pgrC7C29q0zuxPZDl+0EWBlbkqFYBwno=; b=scFFl0muAZhV/DcjIFYNhRG4RY2h0R7QJiWrtj1qcUsjm3KHtaqCC76GjI9F/xOF2V faZvxscQk6Pc3ze9JozRcKjDdJ2wy/0rL8whuwWb6tsAtFmPZAMEkJ9a7xPQdgUk9pbs pXZVZXQchbmsDqfE0KmIoiLcS2UgIYvN8PWCjPpt92BHKZ/YDXLlV6QPfZM813r2NKUB pnF41yaCQ08BvHFv25iCfeqnI2HmysCMIS1JG+YbWNvhL5OuZdsZx+P8Ro2O23RnNgVL JhgOaOpBzGUFOLZ/IvRis8L25UL9SdJfsPK35t1Yixbn6KoGWSo6sNmM5Kf/VH8oE7LZ c/1A== X-Gm-Message-State: AKS2vOxjsC739hKfZf/wPh66axuoz66JLB44sacqB1HBSH7DS9MQrl6R 6eKrex9/7kOVmPIYYdInAI31MsKTKjZq5FceVTvE X-Received: by 10.84.218.2 with SMTP id q2mr21969836pli.208.1497901530141; Mon, 19 Jun 2017 12:45:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.151.167 with HTTP; Mon, 19 Jun 2017 12:45:29 -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:45:29 +0200 Message-ID: To: Levi Morrison Cc: Ilija Tovilo , =?UTF-8?Q?Bj=C3=B6rn_Larsson?= , Fleshgrinder , PHP internals Content-Type: multipart/alternative; boundary="94eb2c1a336e9cee470552556092" Subject: Re: [PHP-DEV] [RFC]Discuss] Syntax for Arrow Functions From: rasmus@mindplay.dk (Rasmus Schultz) --94eb2c1a336e9cee470552556092 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Or maybe it'll look okay if you format the code? $things->forEach({$v =3D> { foo($v); bar($v); }}); Still looks kinda crazy with the closing "}})" though... On Mon, Jun 19, 2017 at 9:43 PM, Rasmus Schultz wrote: > 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 `|` charact= ers 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. >> > > --94eb2c1a336e9cee470552556092--