Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98193 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18130 invoked from network); 4 Feb 2017 18:05:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2017 18:05:27 -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.80.98 as permitted sender) X-PHP-List-Original-Sender: ilija.tovilo@me.com X-Host-Fingerprint: 17.172.80.98 st11p00im-asmtp004.me.com Received: from [17.172.80.98] ([17.172.80.98:41779] helo=st11p00im-asmtp004.me.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BF/18-38491-4E716985 for ; Sat, 04 Feb 2017 13:05:26 -0500 Received: from process-dkim-sign-daemon.st11p00im-asmtp004.me.com by st11p00im-asmtp004.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OKV009003BWSW00@st11p00im-asmtp004.me.com> for internals@lists.php.net; Sat, 04 Feb 2017 18:05:21 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=4d515a; t=1486231521; bh=tpQzEKZMS8VwvELuWKNOAZRmhvSwgllGpc9etWSZfjI=; h=Date:From:To:Message-id:Subject:MIME-version:Content-type; b=L7tq7pqay6BQxPEUgFh/4iTshIpFuwS7yQfuNBgzLmw8jTdVAg/HZL/Q4DPMEkZWs neq+YtkJA9h3YKedXyO2n/k9cEAsD+OXIyzLH6NlzDRQvUNNvBPLQZHAejdNx82d9w +MZkRp1o9V9oxnOVHZ/KsyGaBTXdraE3mL6W8YgP/Tbq9eaB3Ny8NycftdC1QqW2XT 523udrIJAHXwzBSCsoMaSO1uR9zaX+ct1UbEXW7wLOEeimlUaabwks5aEkxXBhQRc7 kt85ZFED8Nvlgxdh0uxSoxhy8xNY7LHaKPyX4dS1LVUiZ5sEU62MIpNBIIYDIctEls 1GHcZn8d3RAbQ== Received: from icloud.com ([127.0.0.1]) by st11p00im-asmtp004.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OKV0055X3KVIO20@st11p00im-asmtp004.me.com>; Sat, 04 Feb 2017 18:05:21 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-02-04_15:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=30 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1702040192 Date: Sat, 04 Feb 2017 19:04:43 +0100 To: Stephen Reay Cc: internals Message-ID: <09219b11-e324-48e1-80c0-7f95e0130795@Spark> In-reply-to: <2A981BF8-0CE6-4CF1-8C13-0FDD776D5132@koalephant.com> References: <19.45.38491.677D4985@pb1.pair.com> <611b72db-420f-4963-ab92-0ddf977a0aaa@Spark> <9AF0D2F6-D668-418C-8B96-3320D9D245ED@trowski.com> <5722B01C-A621-4C13-B34B-383B0D9753F9@koalephant.com> <22B18CB2-0383-4D4D-9B55-91A748725AC9@trowski.com> <77287A6A-C3E9-4C93-A1F2-2899DAEA8738@koalephant.com> <119a1b84-edff-424c-99ba-fd14cbc23ce4@Spark> <75d6f740-92ee-4906-a668-f8c83039d300@Spark> <99D2DDA5-0C1B-4DE0-B91F-DB9004A75327@koalephant.com> <2A981BF8-0CE6-4CF1-8C13-0FDD776D5132@koalephant.com> X-Readdle-Message-ID: 09219b11-e324-48e1-80c0-7f95e0130795@Spark MIME-version: 1.0 Content-type: multipart/alternative; boundary=589617dd_301e9b25_4609 Subject: Re: [PHP-DEV] [RFC][Discuss] Arrow Functions From: ilija.tovilo@me.com --589617dd_301e9b25_4609 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > I personally don=E2=80=99t see a huge use for this in my own work actua= lly, I=E2=80=99m just trying to make sure that something I will likely ha= ve to live with from *other* developers isn=E2=80=99t impossible to read,= that=E2=80=99s all. But I agree that most people seem focussed on the ac= tual syntax. Well, I do. We use closures quite extensively at our workplace since we=E2= =80=99ve started using the functional PHP library: https://github.com/lstrojny/functional-php Here=E2=80=99s a silly Swift vs. PHP example: =60=60=60Swift let x =3D 4 let y =3D =5B1, 2, 3, 4=5D =C2=A0 =C2=A0 .map =7B =240 * x =7D =C2=A0 =C2=A0 .filter =7B =240 > x =7D =60=60=60 =60=60=60PHP =24x =3D 4; =24y =3D =5B1, 2, 3, 4=5D; =24y =3D map(=24y, function (=24val) use (=24x) =7B return =24val * =24x;= =7D); =24y =3D filter(=24y, function (=24val) use (=24x) =7B return =24val > =24= x; =7D); =60=60=60 Don=E2=80=99t you agree that the Swift example is much more readable=3F I=E2=80=99d also like to say that this is a rather fair example. The PHP code can get worse when using longer variable names, more capture= d variables and type hints. > All I would ask is that one of the vote choices for syntax is to re-use= the existing function keyword. =46air enough. The voting about syntax was only a suggestion though. Levi= has never agreed to that :) Cheers On 4 =46eb 2017, 17:26 +0100, Stephen Reay , = wrote: > Hi Ilija, > > > On 4 =46eb 2017, at 23:19, ilija.tovilo=40me.com wrote: > > > > Hey Stephen > > > > > You=E2=80=99re really starting to lose me now. You want types but d= on=E2=80=99t want to define them, and you=E2=80=99re somehow mixing phpdo= c into this. > > > > Because we use PHPDoc to provide type hints to the IDE where PHP does= n=E2=80=99t support them yet (variables and properties). > > > > > Currently PHP has zero support for =46oo=5B=5D (or array<=46oo> if = you prefer) as a type hint. In *theory* an IDE could use the calling scop= e=E2=80=99s context (assuming the source of the array is purely local or = from arguments/return values that are typed) to infer types, but I haven=E2= =80=99t seen it, and I would likely still use type hints, to cover the ca= se where something changes elsewhere. > > > > That=E2=80=99s because you don=E2=80=99t trust it ;) You should be ab= le to trust it. > > > > But anyway, that=E2=80=99s beside the point. Let=E2=80=99s get back t= o the R=46C. > > > > > What were you saying about not everyone being the same=3F > > > > What I=E2=80=99m saying is that maybe it would make sense to vote for= syntax, as this would make most people happy. > > People seem to complain about that the most but agree with the genera= l idea of the R=46C. > > > > I personally don=E2=80=99t see a huge use for this in my own work actua= lly, I=E2=80=99m just trying to make sure that something I will likely ha= ve to live with from *other* developers isn=E2=80=99t impossible to read,= that=E2=80=99s all. But I agree that most people seem focussed on the ac= tual syntax. > > All I would ask is that one of the vote choices for syntax is to re-use= the existing function keyword. > > Cheers > > Stephen > --589617dd_301e9b25_4609--