Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99367 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11620 invoked from network); 5 Jun 2017 17:55:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2017 17:55:34 -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 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wm0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:33659] helo=mail-wm0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BF/A2-27119-51B95395 for ; Mon, 05 Jun 2017 13:55:34 -0400 Received: by mail-wm0-f54.google.com with SMTP id m7so24163006wmg.0 for ; Mon, 05 Jun 2017 10:55:33 -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:to:from:message-id; bh=yJB562Jo363ts8JwSBf2n2yVG6skxx/FaegZWieV/SM=; b=OgYVvpTh+mx09+d5/oxeKZWYHkm2ACPeq/Jtrth2NFhHeT6jyMzrTaDHa2U9Az1MUC BASKzOS6O4MUBOoLwMKKjXoq7s9i48vvwwMvxYrmTNOLvpN1H8UBEyNSzkYbPxCWNC3T wEAKzNFqnwHnS/ZtaDwDr7D/S8dcoohOToMqesuMJJq8KJ4pZv18lXE/nDQGJ1UG3Kqv ekKqDg/03nH/+guzJJ2ar67NaD+IGZxVA+/FgNrxhnewCBYW1hAR7YaXeyglP2mSBN+r 0xWayzLF4yml7X4GhW3Sfc284/8TaTGQCM9p7iU4Dxo/xtYGEA3LwEWiR/DqBwawwDxJ yJzA== 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:to:from:message-id; bh=yJB562Jo363ts8JwSBf2n2yVG6skxx/FaegZWieV/SM=; b=cofXIWwQWmxK8efpfhQJcLtvN0xnG9lmiE4GBVYo4NFvx3xiij/bcCsaAouaFeDfHb jZNoCGKYFt0uv2sSVDGQnZNPPesTFhyfAFLyd7FyL8M/45VG/hwT03ZpuccKvZ7iIJq+ nknXYmeiwwH9B6N4q8ziYIjRc/Hx+cvliASRrrtipsSJpN5gr8gRg2G+pAp9F8V9H3zi rXhE5DV5UW2+TjFnHsRTSAzVImqJ9d5CMxZSsGGxcfz/MjTCpAWM+F1+dcTplcyaXp1l zSzpWLGZ7yxFrhHdCvyL73/qRRkRPFSS8L2o4Ej14dshIbjlLemVv6hQkzhW0O3sR47f 7bLw== X-Gm-Message-State: AODbwcCcFEHk+NKx53yIbHWDaK/oPrnATPTVuZ2feml4fyIg1a4WU377 c3RJWUeB+mm7tWOV X-Received: by 10.28.145.12 with SMTP id t12mr8535987wmd.46.1496685331119; Mon, 05 Jun 2017 10:55:31 -0700 (PDT) Received: from ?IPv6:2a00:23c4:4bd2:6e00:d1ee:855:249e:7ea8? ([2a00:23c4:4bd2:6e00:d1ee:855:249e:7ea8]) by smtp.gmail.com with ESMTPSA id u141sm11788123wmd.28.2017.06.05.10.55.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jun 2017 10:55:30 -0700 (PDT) Date: Mon, 05 Jun 2017 18:55:25 +0100 User-Agent: K-9 Mail for Android In-Reply-To: References: <6357d97c-3f2e-4cf8-cb1f-cb7f7ccccf7c@telia.com> <7eaef49b-bf60-9aa1-e812-8430164e3178@garfieldtech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: internals@lists.php.net Message-ID: <3F920987-38CB-42DD-888D-824430C36F14@gmail.com> Subject: Re: [PHP-DEV] [RFC]Discuss] Syntax for Arrow Functions From: rowan.collins@gmail.com (Rowan Collins) On 5 June 2017 18:17:06 BST, Fleshgrinder wrote: >Could someone explain me again what the problem with the simple >fat-arrow and normal parenthesis is? Cannot find it anymore (too many >messages in too many thread I guess)=2E I would guess that it has to do >with the arbitrary look-ahead that is required to check for the fat >arrow before the lexer knows that this is a short closure and not some >parenthesis that simply groups something=2E=20 I think it's not just a case of implementation problems, it's actually amb= iguous with current syntax: $foo =3D array( ($x) =3D> 42 ); Sure, those inner brackets are redundant, so it's not likely to break much= actual code, but it's kind of weird to have this one case magically turn i= nto a closure, when anything else you put in those brackets would just be u= sed as the array key: $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 ); Even if we could teach the parser to understand it, I'd personally be agai= nst it for the difficulty of *humans* parsing it=2E I find shorthand closur= es hard enough to read anyway, especially when people suggest things like (= $x) =3D> ($y) =3D> $x * $y * $z; Regards, --=20 Rowan Collins [IMSoP]