Re: [RFC] Closure::call and Function Referencing as Closures

From: Date: Mon, 04 Aug 2014 11:36:27 +0000
Subject: Re: [RFC] Closure::call and Function Referencing as Closures
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-76332@lists.php.net to get a copy of this message
On 3 August 2014 23:50, Andrea Faulds <ajf@ajf.me> 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’m > 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 = 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?

« previous php.internals (#76332) next »