Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98096 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43100 invoked from network); 31 Jan 2017 21:44:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2017 21:44:15 -0000 Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.84 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.84 blu004-omc2s9.hotmail.com Received: from [65.55.111.84] ([65.55.111.84:50278] helo=BLU004-OMC2S9.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 69/CC-51557-D2501985 for ; Tue, 31 Jan 2017 16:44:14 -0500 Received: from BLU436-SMTP190 ([65.55.111.73]) by BLU004-OMC2S9.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Tue, 31 Jan 2017 13:44:10 -0800 X-TMN: [zo5gjmpKvbos027Zn2pLitjHV/rf50Ts] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_FCC3A826-507A-4E19-B9BD-DBF550CE0B73" MIME-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Date: Tue, 31 Jan 2017 22:44:05 +0100 In-Reply-To: CC: PHP internals To: "Christoph M. Becker" , Michael Morris , Larry Garfield References: <3F428CA4-8211-44E6-9B60-62ADB47934B3@koalephant.com> <642a72cd-e322-0b22-452f-dfbd521aee02@php.net> <37679ae0-eb90-2367-7fc0-8f0adf97a965@garfieldtech.com> X-Mailer: Apple Mail (2.3251) X-OriginalArrivalTime: 31 Jan 2017 21:44:08.0604 (UTC) FILETIME=[26E2ADC0:01D27C0B] Subject: Re: [PHP-DEV] [RFC][Discuss] Arrow Functions From: bobwei9@hotmail.com (Bob Weinand) --Apple-Mail=_FCC3A826-507A-4E19-B9BD-DBF550CE0B73 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" > Am 31.01.2017 um 19:41 schrieb Christoph M. Becker = : >=20 > On 31.01.2017 at 19:16, Michael Morris wrote: >=20 >> On Tue, Jan 31, 2017 at 12:29 PM, Larry Garfield = >> wrote: >>=20 >>> My question is why there's no mention of HHVM short closures, or the >>> previous RFC to take that approach. See: >>>=20 >>> https://docs.hhvm.com/hack/lambdas/introduction >>=20 >> For what it's worth I'd rather look at >>=20 >> array_map( $x =3D=3D> $x + 1); >>=20 >> than >>=20 >> array_map( fn($x) =3D> $x + 1 ) >>=20 >> Not to mention the former isn't a bc break. >=20 > Neither is supposed to work, though. :) >=20 > Anyhow, I'm not sure whether I'd prefer >=20 > array_map($a, $b, $c =3D=3D> $a + $b + $c, $a1, $a2, $a3) >=20 > over >=20 > array_map(fn($a, $b, $c) =3D> $a + $b + $c, $a1, $a2, $a3) >=20 > or maybe >=20 > array_map(fn $a, $b, $c =3D> $a + $b + $c, $a1, $a2, $a3) >=20 > Somehow, I tend to like a trailing keyword for better left-to-right > readability. >=20 > --=20 > Christoph M. Becker The RFC states that we're needing some form of a prefix in order to = avoid implementing gigantic lexer hacks. HHVM internally implements it by parsing some part of the syntax INSIDE = the lexer and then emitting a token before the first parameter to tell = the parser where a short Closure begins. Having a normal terminal symbol easily allows the parser to detect short = Closures, without any hacks. It is just not a practical option from a technical point of view, and = thus not worth even considering. Bob= --Apple-Mail=_FCC3A826-507A-4E19-B9BD-DBF550CE0B73--