Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76332 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56337 invoked from network); 4 Aug 2014 11:36:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Aug 2014 11:36:26 -0000 Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.49 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 209.85.216.49 mail-qa0-f49.google.com Received: from [209.85.216.49] ([209.85.216.49:40151] helo=mail-qa0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/51-46246-8307FD35 for ; Mon, 04 Aug 2014 07:36:24 -0400 Received: by mail-qa0-f49.google.com with SMTP id dc16so6669841qab.36 for ; Mon, 04 Aug 2014 04:36:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=sBNylk6J3kF3toOwUnsnfjGBFsSUky9Pb2yl9oNjS7U=; b=AHnUm1f9P9wt7PRClfIDOZmj42rk3PkcB84pdd1+biA6cQiYx90TGWQ1RX8WYVbc4l Ad/xlXJO6Bx32PRK8f7wvqC0HjFFtkadYyQrafC0U0yhj57eykt+c0o1F/yeiCt0NjsM dgPuFShB2emvI+A7G1VYbGnDkC3tjhsvUEW1bNjC2WBRsSn1chaFVMgA+KsP3IaKKbYW J7ASkU8UyqnZHL3Fog7EAug2q2WFdGoXbgTgmXjrF12wGBlnA4awhBhCaoNULC3uXZ6X bp5KQ4vpZFNDxN4BfoZAXEURZYc1swdWYLySOkJ95ttrpC8vdYQFyhhjGSTvYztyGidd teog== X-Received: by 10.229.211.132 with SMTP id go4mr35526845qcb.0.1407152207461; Mon, 04 Aug 2014 04:36:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.18.230 with HTTP; Mon, 4 Aug 2014 04:36:27 -0700 (PDT) In-Reply-To: References: Date: Mon, 4 Aug 2014 13:36:27 +0200 Message-ID: To: Andrea Faulds Cc: PHP internals Content-Type: multipart/alternative; boundary=001a1134399678861704ffcc27a9 Subject: Re: [PHP-DEV] [RFC] Closure::call and Function Referencing as Closures From: ocramius@gmail.com (Marco Pivetta) --001a1134399678861704ffcc27a9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 3 August 2014 23:50, Andrea Faulds wrote: > Good evening, > > I am proposing two new RFCs. As they are both inter-related and > complementary, with the second having the first as a prerequisite, I=E2= =80=99m > making just a single email to cover both: > > https://wiki.php.net/rfc/closure_apply > https://wiki.php.net/rfc/function_referencing > > Both have written, tested and working patches aimed for master. > > Thoughts appreciated, thanks. > -- > Andrea Faulds > http://ajf.me/ Hey Andrea, Is the advantage of `Closure#call()` only performance? Because I don't see other advantages otherwise, and I don't think the performance impact is relevant. As for the function referencing RFC, I like it, but it is an annoying syntax that seems to have been built just to accomodate the parser, and that can be worked around in userland with overhead and more typing: $functionReference =3D function ($param) { return functionName($param); }; A syntax that I'd like, and which is IMO BC compatible would be`::function`= : array_map(count::function, [[1, 2], [3, 4]]); This is also very similar and similarly readable to what we have right now with PHP 5.5 through the `::class` meta-constant. There's also no way to use `function` as a constant anywhere, so it should be safe to use that right now. Thoughts? --001a1134399678861704ffcc27a9--