Re: [RFC] [DISCUSSION]: Closure from callable

From: Date: Thu, 01 Oct 2015 20:57:33 +0000
Subject: Re: [RFC] [DISCUSSION]: Closure from callable
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-88626@lists.php.net to get a copy of this message
Hi Dan, Dan Ackroyd wrote:
I'd like to start a discussion of a proposal to allow closures to be created in user-land without having to use a whole lot of reflection code. https://wiki.php.net/rfc/closurefromcallable Thanks to Joe and Bob for the assistance in the patch.
I've wanted something like this for a long time. All that being said, though, I'm not sure a function is the way to do it. In C I can just use the name of a function to get a function pointer, couldn't we do this in PHP somehow? That is, `array_map(strlen, ["foo", "foobar", "elePHPant"]); rather than array_map(closure('strlen'), ...)`. I realise this would be a bit difficult to do, but I think it's a nicer approach. Thanks. -- Andrea Faulds http://ajf.me/

« previous php.internals (#88626) next »