Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99471 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95801 invoked from network); 9 Jun 2017 22:43:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Jun 2017 22:43:48 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.175 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.128.175 mail-wr0-f175.google.com Received: from [209.85.128.175] ([209.85.128.175:36678] helo=mail-wr0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CD/82-01593-3A42B395 for ; Fri, 09 Jun 2017 18:43:47 -0400 Received: by mail-wr0-f175.google.com with SMTP id v111so46239136wrc.3 for ; Fri, 09 Jun 2017 15:43:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:user-agent:in-reply-to:references:mime-version :content-transfer-encoding:subject:cc:from:message-id; bh=TrruFae9cd2s7NCRkeVE5+KSKN4Zf32PI8hPuY/Uy5w=; b=rLbVOMtplNjcAEKcAJkM0bKEmMGwfF9NWJqmyxsJI9WtDWm88HN30YD9jMpt0OXC6o DCBnM7Mfp4y3BpmaHEeP8o0uQaS/OQNU+cLSu/rGsPee/fUibpZ50i/OdLnpuKoCT7tg qmZXunzykNdzcoDuzLZ+mxuLQmqQg5QJmTa8H7bywtnJcOBK3hwEQvF+e4JESMqXYtjr aaBS4lm2HCEwk1g0Zpc6BHBRRq0MCOvFCHYnGvbJGBmI8eGJL7FnTzLweFVxm/r4RoN9 17R/8cxlGrbC1EwwEULJ8txumqrBCWFWPGJODJIYx4C4w+lB+4v5byWRC2YH1dAv2hsL YTkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:user-agent:in-reply-to:references :mime-version:content-transfer-encoding:subject:cc:from:message-id; bh=TrruFae9cd2s7NCRkeVE5+KSKN4Zf32PI8hPuY/Uy5w=; b=GmBtLcoeqA5MBG3pX+OeEK+DAcJTxLTfSv34HpLLucUd4I/KiZ8E2bpLiWMiT/7DgN hHCQGDYI8XCjRZxnB7s53v8PPeRAMLvCI7lLyRTKKTKGWyvFLGrBwE5hqclGlDj8+gnJ 1qqjJKgfiehQ1eQvEXAd0FEeJh+yY2gPKFb27GXIaOzcLJM9l9O8qOZcx8GpOnYddZSw lpfV1uMn4DoCyGHIo7Yh6rW7/KUN5Engn/CeUmYV1rHyoC5cOsUGwB/mBzuCIg7guQsG IWQ/pWJ6YopLcmF1GVAahihTpV4tgW3rjFsBaZ7QcpxQXrznEiwZEuA553hQc4OLTSuF CuDw== X-Gm-Message-State: AODbwcBgsZLoDgkkFRzeUYVzw0RxgTtlDYBy+3LvAprSnK37cKhxTRQj Jq5G4MQCCgW7q31Z X-Received: by 10.223.169.83 with SMTP id u77mr481188wrc.13.1497048223828; Fri, 09 Jun 2017 15:43:43 -0700 (PDT) Received: from [192.168.3.51] ([213.131.175.90]) by smtp.gmail.com with ESMTPSA id 29sm3234465wrv.23.2017.06.09.15.43.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Jun 2017 15:43:42 -0700 (PDT) Date: Fri, 09 Jun 2017 23:43:42 +0100 User-Agent: K-9 Mail for Android 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable CC: PHP internals Message-ID: <1E0ECC7E-B960-46EB-9953-538DF874EA9B@gmail.com> Subject: Re: [PHP-DEV] [RFC]Discuss] Syntax for Arrow Functions From: rowan.collins@gmail.com (Rowan Collins) On 9 June 2017 21:00:48 BST, Niklas Keller wrote: >2017-06-09 15:44 GMT+02:00 Sara Golemon : > >> On Fri, Jun 9, 2017 at 7:23 AM, Bj=C3=B6rn Larsson > >> wrote: >> > If I take the liberty in using the example above on our option >list: >> > 1=2E $someDict->map(fn($v) =3D> $v * 2)->filter(fn($v) =3D> $v % 3); >> > 2=2E $someDict->map(function($v) =3D> $v * 2)->filter(function($v) = =3D> >$v % >> 3); >> > 3=2E $someDict->map($v =3D=3D> $v * 2)->filter($v =3D=3D> $v % 3); >> > 4=2E $someDict->map(($v) =3D> $v * 2)->filter(($v) =3D> $v % 3); = =20 >// >> > Ambiguous >> > 5=2E $someDict->map([]($v) =3D> $v * 2)->filter([]($v) =3D> $v % 3); >> > >> > Old proposals: >> > 6=2E $someDict->map($v ~> $v * 2)->filter($v ~> $v % 3); >> > 7=2E $someDict->map(lambda($v) =3D> $v * 2)->filter(lambda($v) =3D> $= v % >3); >> > >> Something else which really pops in these examples is the effect of >> not needing to use parentheses when embedding a single-arg short >> lambda=2E 3 and 6 in your list read cleaner to me (due to the lack of >> parenthesis clutter)=2E Sadly ~> has the same hacky implementation >> issues as =3D=3D>, but I think that shows a little bit of why the >HackLang >> team decided the messy lexer was worth the clearer syntax=2E > > >Another possible syntax (dunno whether this has already been suggested >on-list): > >$function =3D { $x =3D> 2 * $x }; >$function =3D { ($x) =3D> 2 * $x }; >$function =3D | $x =3D> 2 * $x |; >$function =3D | ($x) =3D> 2 * $x |; > >Nikita and Levi prefer it with parenthesis, I prefer it without, >because I >think it's unnecessary clutter=2E I already suggested the brace version, and Levi said it would conflict in = the parser: https://externals=2Eio/thread/911#email-15331 I don't know enou= gh about parsing to comment on what workarounds would be possible=2E Regards, --=20 Rowan Collins [IMSoP]