Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99540 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25461 invoked from network); 18 Jun 2017 18:42:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2017 18:42:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=ilija.tovilo@me.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ilija.tovilo@me.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain me.com designates 17.172.220.114 as permitted sender) X-PHP-List-Original-Sender: ilija.tovilo@me.com X-Host-Fingerprint: 17.172.220.114 st11p02im-asmtp002.me.com Received: from [17.172.220.114] ([17.172.220.114:16869] helo=st11p02im-asmtp002.me.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C1/22-13828-F99C6495 for ; Sun, 18 Jun 2017 14:42:40 -0400 Received: from process-dkim-sign-daemon.st11p02im-asmtp002.me.com by st11p02im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0ORR006008OWYC00@st11p02im-asmtp002.me.com> for internals@lists.php.net; Sun, 18 Jun 2017 18:42:36 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=04042017; t=1497811356; bh=8S7neWJRJYpehPQbB2HkYdCe6RMIkhxG6LxTUXhRR2g=; h=Content-type:MIME-version:Subject:From:Date:Message-id:To; b=IIenIZaXigf7LF9srRprqme46FMGwSmUMuNcuCtp+dDTV9RZXR43AKsE6rzS42Zgx io+De3fu9QQlZTRMjWdfWb9zYMJNwCGYhFdblrmPHY64D8jnvTsizT0szNt6sbLbOt qK8ykCAXpoCaooP9GABZ/hcYeF5Vw3F+9iq9pvSZVnxraBAcUuput0t2j37GD792Kc KTZ+tKKgOkBIxImz7saMF+ao86vNeU/ihMwedr/cN/dozPqFdW/f/hw2DCtyZuVHTX mUmTgi7jG01sYbR5NaGrwzuxDhlcEGU7hE9j41kD4KN3g3TwjYppA8sUhlCWUv50SP 4FCMFxd3Q0CaA== Received: from icloud.com ([127.0.0.1]) by st11p02im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0ORR00I63AMRR820@st11p02im-asmtp002.me.com>; Sun, 18 Jun 2017 18:42:30 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-18_13:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=15 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1701120000 definitions=main-1706180338 Content-type: text/plain; charset=utf-8 MIME-version: 1.0 (Mac OS X Mail 10.3 \(3273\)) In-reply-to: Date: Sun, 18 Jun 2017 20:42:27 +0200 Cc: =?utf-8?Q?Bj=C3=B6rn_Larsson?= , Fleshgrinder , PHP internals Content-transfer-encoding: quoted-printable Message-ID: <3C763609-54FC-480B-AE95-94A1873226E0@me.com> 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> <5fe1eefe-1c4f-4c31-c975-ab6c768c977c@telia.com> To: Rasmus Schultz X-Mailer: Apple Mail (2.3273) Subject: Re: [PHP-DEV] [RFC]Discuss] Syntax for Arrow Functions From: ilija.tovilo@me.com (Ilija Tovilo) > I don't agree that the fn keyword solves the ambiguity problem - it = looks > exactly like a function call. Right. But it does solve the ambiguity if `fn` is a keyword which is = what the RFC suggests. > On 18 Jun 2017, at 18:40, Rasmus Schultz wrote: >=20 > I don't agree that the fn keyword solves the ambiguity problem - it = looks > exactly like a function call. >=20 > As for the backslash, my honest reaction is, ugh, please, no more > backslashes - PHP (and every other language) uses backslashes for = escaping > in strings, it already looks pretty awkward in namespaces, this won't = help. >=20 >=20 > On Sun, Jun 18, 2017 at 12:58 PM, Ilija Tovilo = wrote: >=20 >> The backslash has actually been one of the earlier options if I = remember >> correctly. >> I definitely prefer the `fn` keyword as it=E2=80=99s only one = character more but >> adds a better visual hint to the arrow function. >>=20 >> I=E2=80=99m also not sure why we=E2=80=99d choose a different arrow = (`=3D=3D>` or `~>`) when >> the ambiguity is solved through either a the backslash or the `fn` = keyword. >>=20 >>=20 >>> On 15 Jun 2017, at 17:00, Bj=C3=B6rn Larsson = >> wrote: >>>=20 >>> Den 2017-06-15 kl. 15:34, skrev Fleshgrinder: >>>=20 >>>> On 6/15/2017 3:29 PM, Bj=C3=B6rn Larsson wrote: >>>>> Seems like the constraints on this feature makes it hard to fly, = i.e. >>>>> 1. Not a hackish implementation >>>>> 2. Non ambiguous syntax >>>>> 3. Easy to parse & use syntax for the human >>>>>=20 >>>>> HackLang then prioritised 2 & 3 making the end-users happy, but >>>>> had to sacrifise a clean implementation. Any clue if this was a = one- >>>>> time effort once it was done or something with a lot of drawbacks >>>>> in terms of maintenance, performance, evolution etc? >>>>>=20 >>>>> r//Bj=C3=B6rn >>>>>=20 >>>> On Reddit someone proposed the following syntax: >>>>=20 >>>> \() =3D> echo 'Hello, World' >>>>=20 >>>> It is used by Haskell if I remember correctly and should not be >>>> ambiguous since `(` is not allowed in names of classes or = functions. It >>>> actually aligns well with functions that are called with a >>>> fully-qualified name (e.g. `\printf('')`). >>>>=20 >>>> Not sure if it would still require hacks though. >>>>=20 >>> So applying that one on Sara's example becomes with some >>> options for the arrow: >>> 8. $someDict->map(\($v) =3D> $v * 2)->filter(\($v) =3D> $v % 3); >>> 9. $someDict->map(\($v) =3D=3D> $v * 2)->filter(\($v) =3D=3D> $v % = 3); >>> 10. $someDict->map(\($v) ~> $v * 2)->filter(\($v) ~> $v % 3); >>>=20 >>> Interesting :) >>>=20 >>> r//Bj=C3=B6rn >>>=20 >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php < >> http://www.php.net/unsub.php> >>=20