Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54343 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35393 invoked from network); 4 Aug 2011 09:03:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Aug 2011 09:03:22 -0000 Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 87.106.212.190 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 87.106.212.190 s15355703.onlinehome-server.info Linux 2.6 Received: from [87.106.212.190] ([87.106.212.190:60884] helo=s15355703.onlinehome-server.info) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/03-18399-8506A3E4 for ; Thu, 04 Aug 2011 05:03:21 -0400 Received: from hwhost.local (85-218-15-56.dclient.lsne.ch [85.218.15.56]) by s15355703.onlinehome-server.info (Postfix) with ESMTPA id 5EABEE4018; Thu, 4 Aug 2011 11:03:17 +0200 (CEST) Message-ID: <4E3A6054.90801@hoa-project.net> Date: Thu, 04 Aug 2011 11:03:16 +0200 Reply-To: ivan.enderlin@hoa-project.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:5.0) Gecko/20110624 Thunderbird/5.0 MIME-Version: 1.0 To: Rasmus Lerdorf CC: Lazare Inepologlou , internals@lists.php.net References: <4E3A48F2.4000503@lerdorf.com> In-Reply-To: <4E3A48F2.4000503@lerdorf.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] An implementation of a short syntax for closures From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") Hi all :-), On 04/08/11 09:23, Rasmus Lerdorf wrote: > On 08/04/2011 12:08 AM, Lazare Inepologlou wrote: >> $add =3D | $x |=3D> | $y : $x |=3D> $x+$y; > This does not seem to match the syntax of any language I know of so > people are going to have a hard time figuring out what this does. It's > not even clear that |=3D> is a new operator there due to the dangling = |, > which as you say conflicts with the regular | operator. Plus it is only= > useful in one limited type of trivial closure usage. This syntax reminds me the =E2=80=9Cblock lambda syntax=E2=80=9D, present= ed on the=20 ECMAScript's wiki [1] about the future of ECMAScript6. It seems they=20 tend to choose the =E2=80=9Carrow function syntax=E2=80=9D [2], which is = more natural=20 and more readable. You can found pros and cons on the wiki, along with a = lot of use cases/examples (including rebinding this!). For a quicker introduction to these two short syntaxes, I would suggest=20 you to read the conference =E2=80=9CFalsyValues=E2=80=9D [3], from slide = 31 to 36,=20 recently given by Dmitry Soshnikov about the future of ECMAScript 6 (all = the conference is a beauty, a must-read). > In PHP we try really hard not to invent new unfamiliar syntax. We try t= o > stick with things that have some basis in either the existing syntax or= > in other popular languages that the average PHP developer might be > exposed to. +1. It must be the result of a long reflection and we should get a large = vote from the community before choosen one syntax. Best regards. [1] [2] [3]=20 --=20 Ivan Enderlin Developer of Hoa Framework http://hoa.42/ or http://hoa-project.net/ Member of HTML and WebApps Working Group of W3C http://w3.org/