Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99538 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6691 invoked from network); 18 Jun 2017 10:58:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2017 10:58:37 -0000 Authentication-Results: pb1.pair.com header.from=ilija.tovilo@me.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ilija.tovilo@me.com; spf=pass; 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:61888] helo=st11p02im-asmtp002.me.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/B0-13828-9DC56495 for ; Sun, 18 Jun 2017 06:58:35 -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 <0ORQ00C00OXQ9R00@st11p02im-asmtp002.me.com> for internals@lists.php.net; Sun, 18 Jun 2017 10:58:31 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=04042017; t=1497783511; bh=3/xJey/CdWR7fJB6nKYbUr9XPXBQcd/4YWVwIpDcl0w=; h=From:Message-id:Content-type:MIME-version:Subject:Date:To; b=3xud5osn3r4oxvvE6YlyM3Q4hcuS2FFNo8Sm1DnB8XkPuqvbYDjncQuwfENodxB7n m9pX+L0A3LyjvqL96UYTm5QuZp+8m4d1U7Ok04s59LvO5TqMGUpdYb63EfPcv6RxOy gU83cbio2ilgLIyZk4S5nbSvZDz+6p+tIRNMuzy7LoARdWVKWgoZSSReIq1MCZRpiB PL1w5vCUMaKqpM2rdwS/prWp+j8R8MNAl2vG3bfa7lmLgrIRZzHH1Ur1Xegsy88yj9 aDnVjCf8R5SDt1fbccCLmWcOyXBPRK4AjZD6XdnMh/OQ283mSIjQt+2g8UqfAvqHa1 8YGTXLwb4aIig== 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 <0ORQ013S3P5FDP40@st11p02im-asmtp002.me.com>; Sun, 18 Jun 2017 10:58:30 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-06-18_07:,, 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-1706180195 Message-ID: Content-type: multipart/alternative; boundary="Apple-Mail=_1EB1DC1D-B98E-425B-8568-FD6B9E9CE7FE" MIME-version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Date: Sun, 18 Jun 2017 12:58:26 +0200 In-reply-to: <5fe1eefe-1c4f-4c31-c975-ab6c768c977c@telia.com> Cc: Fleshgrinder , PHP internals To: =?utf-8?Q?Bj=C3=B6rn_Larsson?= 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> X-Mailer: Apple Mail (2.3273) Subject: Re: [PHP-DEV] [RFC]Discuss] Syntax for Arrow Functions From: ilija.tovilo@me.com (Ilija Tovilo) --Apple-Mail=_1EB1DC1D-B98E-425B-8568-FD6B9E9CE7FE Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 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. 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. > 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 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php = --Apple-Mail=_1EB1DC1D-B98E-425B-8568-FD6B9E9CE7FE--