Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46110 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29784 invoked from network); 19 Nov 2009 18:22:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Nov 2009 18:22:56 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.117 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.117 us-mr1.zend.com Linux 2.4/2.6 Received: from [63.205.162.117] ([63.205.162.117:42480] helo=us-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BD/8C-65535-FFC850B4 for ; Thu, 19 Nov 2009 13:22:56 -0500 Received: from us-gw1.zend.com (us-ex1.zend.net [192.168.16.5]) by us-mr1.zend.com (Postfix) with ESMTP id 5B9AAE123E; Thu, 19 Nov 2009 10:20:29 -0800 (PST) Received: from [192.168.16.203] ([192.168.16.203]) by us-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 19 Nov 2009 10:22:53 -0800 Message-ID: <4B058CFD.9060207@zend.com> Date: Thu, 19 Nov 2009 10:22:53 -0800 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Victor Bolshov , 'PHP Internals' References: <4B01A4C2.8030602@gmx.net> <10845a340911180153g64333917p591dfff925f907fd@mail.gmail.com> <4B044070.1010607@zend.com> <4B0469C3.4020503@zend.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 19 Nov 2009 18:22:53.0195 (UTC) FILETIME=[4EF6FDB0:01CA6945] Subject: Re: [PHP-DEV] Closures and $this From: stas@zend.com (Stanislav Malyshev) Hi! > If php-people really would like rebinding $this, I beleive this should > be done via method like Closure->bindTo() - to make the fact of > rebinding clear in the code. > > However, there is a problem with rebinding $this - that was not > mentioned yet, I think. This can be a problem, but since PHP is not a compiled language, this problem already exists - all method names are only checked in runtime anyway, so it doesn't matter if you rebind the closure or not. Of course, with rebinding you can easily shoot yourself in the foot by calling non-existing method - but so you can with $foo->$bar() or $foo() or a number of other ways. So I think if this construct is expressed in a way that makes the intent clear (i.e., no implicit rebinding) then it would be OK. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com