Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88658 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63640 invoked from network); 4 Oct 2015 10:16:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Oct 2015 10:16:36 -0000 Authentication-Results: pb1.pair.com header.from=mail@dasprids.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mail@dasprids.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain dasprids.de from 46.4.80.198 cause and error) X-PHP-List-Original-Sender: mail@dasprids.de X-Host-Fingerprint: 46.4.80.198 server1.dasprids.de Received: from [46.4.80.198] ([46.4.80.198:53853] helo=mail.dasprids.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/15-31315-28CF0165 for ; Sun, 04 Oct 2015 06:16:35 -0400 Received: from [192.168.0.86] (unknown [5.158.132.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mail@dasprids.de) by mail.dasprids.de (Postfix) with ESMTPSA id 831E734403C2 for ; Sun, 4 Oct 2015 12:16:31 +0200 (CEST) To: internals@lists.php.net References: Message-ID: <5610FC92.4090005@dasprids.de> Date: Sun, 4 Oct 2015 12:16:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] [DISCUSSION]: Closure from callable From: mail@dasprids.de (Ben Scholzen 'DASPRiD') On 29.09.2015 16:23, Dan Ackroyd wrote: > Hello internals, > > 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. Your first example on the page is a little weird to me. You claim that one currently needs to have the callback method public, although you can easily work around that. Instead of doing this, as in your example: return [$this, 'genericValidation'] you could just do this: return function ($data) { return $this->genericValidation($data); } and keep the actual callback method private/protected. -- Ben Scholzen 'DASPRiD' Community Review Team Member | mail@dasprids.de Zend Framework | http://www.dasprids.de