Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99368 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13414 invoked from network); 5 Jun 2017 18:06:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2017 18:06:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.82 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.82 mx101.easyname.com Received: from [77.244.243.82] ([77.244.243.82:46751] helo=mx101.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/03-27119-89D95395 for ; Mon, 05 Jun 2017 14:06:17 -0400 Received: from cable-81-173-132-37.netcologne.de ([81.173.132.37] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1dHwOK-0000rJ-0p; Mon, 05 Jun 2017 18:06:13 +0000 References: <6357d97c-3f2e-4cf8-cb1f-cb7f7ccccf7c@telia.com> <7eaef49b-bf60-9aa1-e812-8430164e3178@garfieldtech.com> <3F920987-38CB-42DD-888D-824430C36F14@gmail.com> To: Rowan Collins , php-internals Message-ID: <00f56526-1731-7000-824a-692ea3ca084c@fleshgrinder.com> Date: Mon, 5 Jun 2017 20:06:03 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <3F920987-38CB-42DD-888D-824430C36F14@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9rHPx9UCtSi2miwVx2lswwW0XFGOnS9jv" X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] [RFC]Discuss] Syntax for Arrow Functions From: php@fleshgrinder.com (Fleshgrinder) --9rHPx9UCtSi2miwVx2lswwW0XFGOnS9jv Content-Type: multipart/mixed; boundary="BrGtMgmAVN2tIcJdtDNA1CsSpavoMT3sC"; protected-headers="v1" From: Fleshgrinder To: Rowan Collins , php-internals Message-ID: <00f56526-1731-7000-824a-692ea3ca084c@fleshgrinder.com> Subject: Re: [PHP-DEV] [RFC]Discuss] Syntax for Arrow Functions References: <6357d97c-3f2e-4cf8-cb1f-cb7f7ccccf7c@telia.com> <7eaef49b-bf60-9aa1-e812-8430164e3178@garfieldtech.com> <3F920987-38CB-42DD-888D-824430C36F14@gmail.com> In-Reply-To: <3F920987-38CB-42DD-888D-824430C36F14@gmail.com> --BrGtMgmAVN2tIcJdtDNA1CsSpavoMT3sC Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 6/5/2017 7:55 PM, Rowan Collins wrote: > I think it's not just a case of implementation problems, it's actually = ambiguous with current syntax: >=20 > $foo =3D array( ($x) =3D> 42 ); >=20 > Sure, those inner brackets are redundant, so it's not likely to break m= uch actual code, but it's kind of weird to have this one case magically t= urn into a closure, when anything else you put in those brackets would ju= st be used as the array key: >=20 > $foo =3D array( f($x) =3D> 42 ); > $foo =3D array( ($x+1) =3D> 42 ); > $foo =3D array( (42) =3D> $x ); > $foo =3D array( (X) =3D> 42 ); > $foo =3D array( ($x) =3D> 42 ); > $foo =3D array( ("$x") =3D> 42 ); >=20 > Even if we could teach the parser to understand it, I'd personally be a= gainst it for the difficulty of *humans* parsing it. I find shorthand clo= sures hard enough to read anyway, especially when people suggest things l= ike ($x) =3D> ($y) =3D> $x * $y * $z; >=20 > Regards, >=20 Ah thanks, yeah, that was the problem. At trivago we have such a super fancy ES6 code base where everything is done in a super cryptic syntax, so that absolutely nobody who is not used to reading this all day has a chance to understand a single thing. So, yeah, I completely agree with you on everything. That being said, they are handy if not overused, like so many features. := ) The pipes should still be in the game. $foo =3D array( |$x| =3D> 42 ); --=20 Richard "Fleshgrinder" Fussenegger --BrGtMgmAVN2tIcJdtDNA1CsSpavoMT3sC-- --9rHPx9UCtSi2miwVx2lswwW0XFGOnS9jv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZNZ2MAAoJEOKkKcqFPVVrJu8P/1FMAo9AQN+zAdGJz3QjgrmJ VGJ5pmMLiBwymSderV57L+EJuI5PwEShPMu3iGX/6FhZo5BsZCgYCTDWazmyPX2S 0FLKgS76AFWqLkdgqni588YlBuMH/hjVHrIFMBwUbL46jcxg+8JhgFJWknyQIhTK qynkDLtwjCssCEk1o4+TSQirglzO+JlzPCsEGDAx7qVmAqe0czPLWaQZ0sXkFDfe eHA4QA10ZdBBS8gKNl74BOKN5dPqL/jmDrX7eQYPm09+7idpC8FeW2fhEHeNG/Ay ensKSqYLRXl2Jn4ZyrqSclgFXvP57/IfoHbOjxuUZSNJxZrbbKxT6PkqDWyf+gvq JIjgiZShmu4hARH5PqPgbuLVOgWuHvggmXcJSJGstUN1mJ1hhegauE+CVHmERj9f Yj7aTjHtsNqUEjKp4SnXSAM8/GYxCxEllWfY7QMuLKXn7rOAX6z0R3SZH4qYGa8w 2pfftM2w1mKgP0Jm2XWJXzZeBD71zvK1xqRx9f8E0P3A85XwujMycyQQnehKVkH5 vZsYwPpTX0DbFGnMaclCF3WW+4Wiv85eNlWIR8pQQ9fW/mMQ4fMvzPArqlCi2opL dZ5RsCVRpUBqX3C75xmwJRc+Ho+YL0ka+B0IqnEhMPMgvQqzbS6oimScT0J6oszE 0Y4DrGD5ln4uhle5l1MK =prW1 -----END PGP SIGNATURE----- --9rHPx9UCtSi2miwVx2lswwW0XFGOnS9jv--