Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88626 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60892 invoked from network); 1 Oct 2015 20:57:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Oct 2015 20:57:37 -0000 X-Host-Fingerprint: 2.218.138.102 unknown Received: from [2.218.138.102] ([2.218.138.102:28217] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/66-26330-04E9D065 for ; Thu, 01 Oct 2015 16:57:37 -0400 Message-ID: <1C.66.26330.04E9D065@pb1.pair.com> To: internals@lists.php.net References: Date: Thu, 1 Oct 2015 21:57:33 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0 SeaMonkey/2.35 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 2.218.138.102 Subject: Re: [RFC] [DISCUSSION]: Closure from callable From: ajf@ajf.me (Andrea Faulds) 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/