Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39259 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88313 invoked from network); 24 Jul 2008 09:11:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2008 09:11:36 -0000 Authentication-Results: pb1.pair.com header.from=chris_se@gmx.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=chris_se@gmx.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.net designates 213.165.64.20 as permitted sender) X-PHP-List-Original-Sender: chris_se@gmx.net X-Host-Fingerprint: 213.165.64.20 mail.gmx.net Linux 2.6 Received: from [213.165.64.20] ([213.165.64.20:56494] helo=mail.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/18-44225-74748884 for ; Thu, 24 Jul 2008 05:11:36 -0400 Received: (qmail invoked by alias); 24 Jul 2008 09:11:32 -0000 Received: from p54A17F89.dip.t-dialin.net (EHLO chris-se.dyndns.org) [84.161.127.137] by mail.gmx.net (mp021) with SMTP; 24 Jul 2008 11:11:32 +0200 X-Authenticated: #186999 X-Provags-ID: V01U2FsdGVkX1/oo14l83roz9A8yeyAkiP46TwhUdM2ZZ7w5Zwh38 pnnjiEtxbArveL Received: from [192.168.100.13] (cobalt.seiler.lan [192.168.100.13]) by chris-se.dyndns.org (Postfix) with ESMTP id D0CEB1934F; Thu, 24 Jul 2008 10:38:38 +0200 (CEST) Message-ID: <488846F2.7080203@gmx.net> Date: Thu, 24 Jul 2008 11:10:10 +0200 User-Agent: Thunderbird 2.0.0.14 (X11/20080421) MIME-Version: 1.0 To: Stanislav Malyshev CC: Lukas Kahwe Smith , PHP Developers Mailing List , kalle@zesix.com References: <8A5D4032-1FC4-44BB-90F3-61B802F10159@pooteeweet.org> <6BD46F4A-2733-4160-9A3E-AD49F3002865@pooteeweet.org> <48863E2B.8040001@zend.com> In-Reply-To: <48863E2B.8040001@zend.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.65 Subject: Re: [PHP-DEV] closures questions From: chris_se@gmx.net (Christian Seiler) Hi! >> so do we even want the toString() method? > > IMHO we should drop toString from Closure. There is one case which *may* cause problems: function doSomething ($callback) { if (!is_callable ($callback)) { throw new Exception (...); } // special treatment if ($callback == 'default') { ... } else { ... } } Here, the comparison of $callback with 'default' will yield a notice that $callback couldn't be converted. The comparison will fail correctly, of course, but it could cause some confusion. The correct way of comparing would obviously be using ===, that won't cause these hickups. Personally, I don't care whether a object-to-string cast is present or not. > I don't think Closure can be meaningfully exported. Can we prohibit it? Unfortunately, currently not, see the var_export code. > I think we can make working clone there - just copy all data, etc. Perhaps. But I'd recommend this should be postponed, as there are quite a few subtleties regarding semantics of bound variables involved. Should there seem to be a strong need for cloning closures by the community, this can always be implemented in a future PHP version. IMHO. Regards, Christian