Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98067 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76983 invoked from network); 31 Jan 2017 10:23:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2017 10:23:39 -0000 Authentication-Results: pb1.pair.com header.from=mike.php.net@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=mike.php.net@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.66 as permitted sender) X-PHP-List-Original-Sender: mike.php.net@gmail.com X-Host-Fingerprint: 74.125.82.66 mail-wm0-f66.google.com Received: from [74.125.82.66] ([74.125.82.66:34145] helo=mail-wm0-f66.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id ED/51-51557-AA560985 for ; Tue, 31 Jan 2017 05:23:39 -0500 Received: by mail-wm0-f66.google.com with SMTP id c85so82935926wmi.1 for ; Tue, 31 Jan 2017 02:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to; bh=FCivK0YMGOA3GQdEYN77WT5rz7LSBjx1SxmlsYFOVGY=; b=XuwU8oZK09YGR8mztH8933LEXAeqGc2+3bDy2l9Wsp9S9FMWIUUYAmZYbiTDr/9+SL DmSCyqcsT4FN6hNEVvKxUHoa1wJ1QwAOfPD0f9pSIbHYgiqiefzYaokpHjjs0/HoU2Dl 1u0ifdJ2mttrBuQ6KVBX5qk9ROjbtn3MuI3jLBTh0R1QaNOGP946ArjZQQhXeiNPeXZv ryqRvQwIs+Ra6zaEUskpDaaJvCws3gZyTSwlWPYFRuwOhPWnBtmxrzWhPXA9Nsp5lSn4 wpQTxuzRugj9+Q1UALMwR/8nGwlxWGnierTCa13A3IPdcsCG8Qp44KZJk0tb7qCQJngf VDqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to; bh=FCivK0YMGOA3GQdEYN77WT5rz7LSBjx1SxmlsYFOVGY=; b=FZNd94PSQcPWzkPK6KKsXm8dyuJMWpXNmMAkUDbmkKAOCjSsRoEQTx4Kf9SYMy4QlE 717VfL4M1ysq0ZNYDu18HYJU6ScUaxSP7tA8IQgd4HDckv2bkp+tHkSjupAEq8g0bo4c a/bDLePmxzLg5jOa8VZ5vowCB6fLdG0tpnkH4CX6yEtsd28f3HnyP5u/si6GYOv6SZyD JBvkgilq0dJgsRzgMGZ47IJj7x6N7yHjyKbLaYt/1Q3cnIghAE6AAkvjwiUJbaxRNs2v rWfqXfkmwEhPkrd9AxAaCc1ufvr4FIMQ2pHT7RnXx6OPZEk8W+Caeh0A9AVl4sub8x8n fvSg== X-Gm-Message-State: AIkVDXJr4TRmTurIKWUClOK4XccMxVIkiiwaEIr82AVd+RJuBYoh9w3bXLT6wdManvFv7w== X-Received: by 10.28.149.199 with SMTP id x190mr17171962wmd.91.1485858215379; Tue, 31 Jan 2017 02:23:35 -0800 (PST) Received: from [192.168.2.207] (89-104-28-113.customer.bnet.at. [89.104.28.113]) by smtp.googlemail.com with ESMTPSA id e74sm23110185wmd.2.2017.01.31.02.23.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Jan 2017 02:23:34 -0800 (PST) Sender: Michael Wallner To: internals@lists.php.net References: <3F428CA4-8211-44E6-9B60-62ADB47934B3@koalephant.com> Message-ID: <642a72cd-e322-0b22-452f-dfbd521aee02@php.net> Date: Tue, 31 Jan 2017 11:23:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <3F428CA4-8211-44E6-9B60-62ADB47934B3@koalephant.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="5OpWWxLidmg9CCVAt4FLraP9ANPcBuTV4" Subject: Re: [PHP-DEV] Re: [RFC][Discuss] Arrow Functions From: mike@php.net (Michael Wallner) --5OpWWxLidmg9CCVAt4FLraP9ANPcBuTV4 Content-Type: multipart/mixed; boundary="j59sL8Bjajba8KsldcrpVkkwmsN1txQcX"; protected-headers="v1" From: Michael Wallner To: internals@lists.php.net Message-ID: <642a72cd-e322-0b22-452f-dfbd521aee02@php.net> Subject: Re: [PHP-DEV] Re: [RFC][Discuss] Arrow Functions References: <3F428CA4-8211-44E6-9B60-62ADB47934B3@koalephant.com> In-Reply-To: <3F428CA4-8211-44E6-9B60-62ADB47934B3@koalephant.com> --j59sL8Bjajba8KsldcrpVkkwmsN1txQcX Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 31/01/17 05:53, Stephen Reay wrote: > Hi Andrea, All, > >> On 31 Jan 2017, at 08:12, Andrea Faulds wrote: >> >> Is it necessary to introduce a new keyword, fn? >> >> I think you'd get a similar benefit from: >> >> function($x) =3D> $arr[$x] >> >> Likewise, is it necessary to restrict auto-capture to the =3D> >> syntax? Couldn't we allow the following? >> >> function ($x) { >> return $arr[$x]; >> } >> > > I agree that the `fn` keyword isn=E2=80=99t really necessary. I=E2=80=99= ve never > quite understood how arrow functions with implied returns etc are > supposed to make for *more* readable code, but if they=E2=80=99re going= to be > part of the language please at least keep some consistency with > regular closures. Yes, I also think that keeping the function keyword would be better. >=20 > In the case that regular closures got auto-capture, would a > `use($foo, $bar, $baz)` segment on a closure still be honoured (i.e. > disable auto-capture), and would it have any impact (positive or > negative) on performance/memory usage? After several years of JS > closure =E2=80=98fun=E2=80=99 I kind of like that with PHP you only inh= erit the > variables you explicitly `use()` in closures. Wouldn't there be just too many existing closures, which do not use `use` but (maybe) expect a clean scope? --=20 Regards, Mike --j59sL8Bjajba8KsldcrpVkkwmsN1txQcX-- --5OpWWxLidmg9CCVAt4FLraP9ANPcBuTV4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEHsPHHd1jWDGjN9aESA4+FLCkx8cFAliQZaUACgkQSA4+FLCk x8dVcAf/fVSxleq/YRjj3RhpovmNomxvId1p1l7cVpAZxg5kNlvm94QHlSZHe29L garpxUdoj1r3EPpU5SzRAxI8EidhTC/Af5XQ9DAVrd6/LNoqQnYqpYw73PxtzOB4 EO6Mee4XvRo4sQKRiYIJZbHMeHKQ/OLmO4JeviP4MkRsRgtEdyaN9j7LXUXwDE8n QreNJdcQnr6AofDWm3IlN8mQ8LStnvHr89xSpC4luA32R1a7TukqczPlWD3oZ3YJ 4wRg+j/mMsU/MQqn8wliZF3lfaV7aXm/QmH50EiWJTSS61HOeEusX/koKhj+9aC3 rxwAuKtAkV6FXzq+cp52J5NAlNLWJw== =U7Ls -----END PGP SIGNATURE----- --5OpWWxLidmg9CCVAt4FLraP9ANPcBuTV4--