Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98179 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92920 invoked from network); 4 Feb 2017 15:41:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2017 15:41:26 -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.97 as permitted sender) X-PHP-List-Original-Sender: ilija.tovilo@me.com X-Host-Fingerprint: 17.172.80.97 st11p00im-asmtp003.me.com Received: from [17.172.80.97] ([17.172.80.97:49316] helo=st11p00im-asmtp003.me.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/73-38491-426F5985 for ; Sat, 04 Feb 2017 10:41:25 -0500 Received: from process-dkim-sign-daemon.st11p00im-asmtp003.me.com by st11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OKU00I00WID0E00@st11p00im-asmtp003.me.com> for internals@lists.php.net; Sat, 04 Feb 2017 15:41:14 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=4d515a; t=1486222874; bh=RxoYlYdqC4sV0VwWCRTnr1JrPjN83vxAX9HIyuvoXSU=; h=Date:From:To:Message-id:Subject:MIME-version:Content-type; b=aelxmy/7urE4fr8muBw/UQTeTNVdPR4fKYPryzZl48pVJ0eLixaj1jcKBs99QqCXU CVTgKDIdltP9UkgB3qRLj4EcQdBZuNg03p6n2HG5cxEBdunjbjs0zVNjKyR14MJJZD BcYU4YBbG/uehm6ck/RqfI9//hV8vqNXg9+N0flanRf2aSybxVAgoWrqTb2xAuICxh GwZAfz2UTWtKrWMe6dODQchaI+v9m++HhK3Ki23vJUFBXw0E7g9T/7JGT6dBUVveju yhUhx27K2irsVjHzK34RHEi7Da4VRWmDeXSELpB+Sh3qkBy247T+yH3bb9D3rB3Me9 QF6wbIViROwOg== Received: from icloud.com ([127.0.0.1]) by st11p00im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OKU00IZGWWNG300@st11p00im-asmtp003.me.com>; Sat, 04 Feb 2017 15:41:13 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-02-04_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=32 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1702040168 Date: Sat, 04 Feb 2017 16:40:05 +0100 To: Stephen Reay Cc: internals Message-ID: <75d6f740-92ee-4906-a668-f8c83039d300@Spark> In-reply-to: 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> X-Readdle-Message-ID: 75d6f740-92ee-4906-a668-f8c83039d300@Spark MIME-version: 1.0 Content-type: multipart/alternative; boundary=5895f616_643c9869_4609 Subject: Re: [PHP-DEV] [RFC][Discuss] Arrow Functions From: ilija.tovilo@me.com --5895f616_643c9869_4609 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hey Stephen > You don't *have to* specify types at all. If you want to use PHP withou= t verifying/requiring types, thats your prerogative, but given the recent= improvements to allow scalar type hinting, I think it=E2=80=99s a mistak= e to say that *any* use of type hints is =E2=80=9Cnot recommended=E2=80=9D= . Sure you don=E2=80=99t but then you loose all the benefits of specifying = types. We want typing but only if we don=E2=80=99t have to specify types = all over the place. I really dislike having to add PHPDocs everywhere jus= t to get some proper autocompletions. > I'm not sure if you've mixed up your terms of if I'm too tired but I do= n't understand what you mean here. The short arrow function *is* the call= ee, and that=E2=80=99s where you=E2=80=99re suggesting we shouldn=E2=80=99= t use type hints. Sorry, that was confusing. I was thinking of a situation like this one: =60=60=60Swift func fetchUsers(callback: (=5BUser=5D) -> Void) =7B =C2=A0 =C2=A0 ... =7D =60=60=60 So, the callee (=60fetchUsers=60) defines what the provided closure must = look like. The caller, on the other hand, doesn=E2=80=99t have to specify that again= as you=E2=80=99re just repeating yourself. =60=60=60Swift fetchUsers =7B user in =C2=A0 =C2=A0// =60user=60 is inferred to be a =60User=60 object =7D =60=60=60 So I don=E2=80=99t think the burden of providing typing information shoul= d be on the caller providing the closure. > The whole issue with that is that using a pipe character could make thi= ngs much less clear/readable if the already established use of pipe for =E2= =80=9Ctype unions=E2=80=9D (currently used in multi-catch) were to be imp= lemented for general type hint usage. > > Note: I=E2=80=99m not saying it=E2=80=99s not possible, but it=E2=80=99= s *much* less readable, and any =E2=80=9Csolution=E2=80=9D just adds more= characters, which is apparently the only reason to not use function(=24f= oo) =3D> =24foo in the first place. But again, that=E2=80=99s personal preference. I like short a precise and= think it=E2=80=99s more readable. Not everyone=E2=80=99s the same. > =C2=A0=46or most people readability isn't just about the number of char= acters. A lot of the time it is. Brains are very good at recognising patterns, th= ey don=E2=80=99t need large keywords for that. As for me, I think it just adds clutter to the actual logic that I=E2=80=99= m interested in. --5895f616_643c9869_4609--