Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99386 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65080 invoked from network); 6 Jun 2017 04:39:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jun 2017 04:39:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=php-lists@koalephant.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=php-lists@koalephant.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain koalephant.com designates 206.123.115.54 as permitted sender) X-PHP-List-Original-Sender: php-lists@koalephant.com X-Host-Fingerprint: 206.123.115.54 mail1.25mail.st Received: from [206.123.115.54] ([206.123.115.54:57196] helo=mail1.25mail.st) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/C9-27119-FE136395 for ; Tue, 06 Jun 2017 00:39:12 -0400 Received: from [192.168.1.14] (unknown [49.48.245.109]) by mail1.25mail.st (Postfix) with ESMTPSA id 94FC8604A3; Tue, 6 Jun 2017 04:38:58 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) In-Reply-To: <559b73f7-c40f-e593-f0e1-51b56210d7cb@telia.com> Date: Tue, 6 Jun 2017 11:38:54 +0700 Cc: Ryan Pallas , Fleshgrinder , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <2053A608-6B66-42FB-A6D7-7CC64E94DA6A@koalephant.com> References: <6357d97c-3f2e-4cf8-cb1f-cb7f7ccccf7c@telia.com> <7eaef49b-bf60-9aa1-e812-8430164e3178@garfieldtech.com> <3F920987-38CB-42DD-888D-824430C36F14@gmail.com> <2f9e73c9-444a-11d0-459a-e261ea8a7080@telia.com> <4077c099-2247-c3c1-7dee-02a6b25f8586@fleshgrinder.com> <559b73f7-c40f-e593-f0e1-51b56210d7cb@telia.com> To: =?utf-8?Q?Bj=C3=B6rn_Larsson?= X-Mailer: Apple Mail (2.3124) Subject: Re: [PHP-DEV] [RFC]Discuss] Syntax for Arrow Functions From: php-lists@koalephant.com (Stephen Reay) >=20 > On 6 Jun 2017, at 03:18, Bj=C3=B6rn Larsson = wrote: >=20 > Den 2017-06-05 kl. 21:23, skrev Ryan Pallas: >=20 >> On Mon, Jun 5, 2017 at 1:09 PM, Fleshgrinder = wrote: >>=20 >>> On 6/5/2017 9:03 PM, Ryan Pallas wrote: >>>> However, ($obj) -> $var is valid variable property syntax. >>>>=20 >>> Gosh, we really have support for everything. :D That one is even = very >>> important for stuff like `(new A)->f()`. >>>=20 >>> How about ~> which I at least cannot think of any place it is used = at >>> all. ~ in binary negation and the only place we use it (I checked = the >>> language parser this time to make sure). >>>=20 >>> I really dislike the =3D=3D> idea. One of the main reasons here is = to write >>> less and it looks too much like =3D> or even >=3D which I really = don't like. >>>=20 >>> ($a, $b) =3D=3D> $a >=3D $b >>>=20 >>> ($a, $b) ~> $a >=3D $b >>>=20 >>>=20 >> I can get behind using the tilde. Keeps it concise, but it's visually >> different than existing syntax, making it easier to recognize (IMO). >>=20 > I think ~>was a proposal in the short closure RFC. Personally I liked = it, > but could also live with =3D=3D>. I recall there was a discussion = about how > easy it was to use tilde on different keyboards / languages. So at = that > point the discussion was about either ~> or =3D=3D> for syntax. >=20 > But back to Levi's list it looks like, at least to me that option 2 & = 4 are > off the table. Leaving option 3 & 1, maybe also option 5. >=20 > Do you think this is a reasonable assumption? >=20 > Also some other proposals has arisen, like using lamda instead of fn = as > a keyword and lastly the ~> one. >=20 > r//Bj=C3=B6rn >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php As someone who sees limited appeal in short closures (Ok, they may make = for slightly simpler constructs that are slightly too complex for a = regular =E2=80=9Ccollect=E2=80=9D type collection method), I see a *lot* = of people spending a *lot* of time to save typing 8 characters = (function). If this feature truly is about making it easier to read, then that = should be your goal: make it easy to mentally parse, basically = instantly. Given that even proponents of the approach are admitting the = syntax can get quite hard to understand quickly, perhaps it=E2=80=99s = time to accept that =E2=80=9Cmore characters=E2=80=9D !=3D=3D =E2=80=9Char= der to read & understand=E2=80=9D and importantly, =E2=80=9Cless = characters=E2=80=9D !=3D=3D =E2=80=9Ceasier to read & understand=E2=80=9D.= How long does it take someone to type function? A second, maybe two? How = many times are other people going to read that, once it=E2=80=99s been = written? Or maybe I=E2=80=99ve got it all wrong, and the goal is literally to = save 8 keystrokes. If that=E2=80=99s the case, please update the RFC = accordingly, to make it clear what the motivations are=20 Cheers Stephen=