Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98180 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94634 invoked from network); 4 Feb 2017 15:50:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2017 15:50:36 -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.96 as permitted sender) X-PHP-List-Original-Sender: ilija.tovilo@me.com X-Host-Fingerprint: 17.172.80.96 st11p00im-asmtp002.me.com Received: from [17.172.80.96] ([17.172.80.96:48670] helo=st11p00im-asmtp002.me.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F4/C3-38491-A48F5985 for ; Sat, 04 Feb 2017 10:50:35 -0500 Received: from process-dkim-sign-daemon.st11p00im-asmtp002.me.com by st11p00im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OKU00F00X2Y4100@st11p00im-asmtp002.me.com> for internals@lists.php.net; Sat, 04 Feb 2017 15:50:01 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=4d515a; t=1486223401; bh=uXi1CHyxOupqLHPzI/Z5LJV3u/qj0VtEKMONQxJTWk0=; h=Date:From:To:Message-id:Subject:MIME-version:Content-type; b=qIHb70bp+FFG6no11tkeruE+WacrRp8Vta/DZ0BC/2OUWjy3D4Fd6Qt5zpMsyORu5 zmY3N1AmiTreeDAbY+Vn2pFZaOlEFDg8kVi/xTnppWxcuDZQLiTBVR32o4EFq4KHFw jBDBPXpBFjCdn45w9MHzkXr22DIz43mJVPEU82skgrIqrdwEHgdra96ZmiFi6aJS8h GE+TfG0Lz0RMDoBIjBRpJYnkHGmyz4g9mhdl0LmUvSQCGiM2hQsASk8BGqQmCty4PE euDN04xb6woTyLMt+z0/hCTKY6YwZ3+7DNI9FS3btbW3KGhHlYTmmF+Ffqxy5mfUi4 guBb/lJR/oO4g== Received: from icloud.com ([127.0.0.1]) by st11p00im-asmtp002.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OKU003FSXBAZ300@st11p00im-asmtp002.me.com>; Sat, 04 Feb 2017 15:50:00 +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-1702040170 Date: Sat, 04 Feb 2017 16:48:27 +0100 To: Stephen Reay Cc: internals Message-ID: In-reply-to: <75d6f740-92ee-4906-a668-f8c83039d300@Spark> 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> X-Readdle-Message-ID: c7e6389b-dbfb-452f-8349-7e98be6a1985@Spark MIME-version: 1.0 Content-type: multipart/alternative; boundary=5895f824_65048f95_4609 Subject: Re: [PHP-DEV] [RFC][Discuss] Arrow Functions From: ilija.tovilo@me.com --5895f824_65048f95_4609 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Ah, my example was of course wrong again -.- The caller should=E2=80=99ve looked like this (although I think you get t= he point): =60=60=60Swift fetchUsers =7B users in =C2=A0 =C2=A0// =60users=60 is inferred to be an=C2=A0array of=C2=A0=60Us= er=60s =7D =60=60=60 Regards On 4 =46eb 2017, 16:41 +0100, ilija.tovilo=40me.com, wrote: > Hey Stephen > > > You don't *have to* specify types at all. If you want to use PHP with= out verifying/requiring types, thats your prerogative, but given the rece= nt improvements to allow scalar type hinting, I think it=E2=80=99s a mist= ake 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 specifyin= g types. We want typing but only if we don=E2=80=99t have to specify type= s all over the place. I really dislike having to add PHPDocs everywhere j= ust to get some proper autocompletions. > > > I'm not sure if you've mixed up your terms of if I'm too tired but I = don't understand what you mean here. The short arrow function *is* the ca= llee, and that=E2=80=99s where you=E2=80=99re suggesting we shouldn=E2=80= =99t 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 mus= t look like. > The caller, on the other hand, doesn=E2=80=99t have to specify that aga= in 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 sho= uld be on the caller providing the closure. > > > The whole issue with that is that using a pipe character could make t= hings 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= implemented 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 a= nd 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 ch= aracters. > > A lot of the time it is. Brains are very good at recognising patterns, = they 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= =99m interested in. > --5895f824_65048f95_4609--