Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:38551 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68698 invoked from network); 23 Jun 2008 17:23:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jun 2008 17:23:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:42584] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/4E-03212-AFBDF584 for ; Mon, 23 Jun 2008 13:23:07 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 23 Jun 2008 20:23:16 +0300 Received: from [192.168.16.110] ([192.168.16.110]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 23 Jun 2008 10:22:58 -0700 Message-ID: <485FDBE2.6020409@zend.com> Date: Mon, 23 Jun 2008 10:22:42 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Alexey Zakhlestin CC: Etienne Kneuss , PHP internals References: <485C5081.1050609@zend.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 23 Jun 2008 17:22:58.0260 (UTC) FILETIME=[C7E3F140:01C8D555] Subject: Re: [PHP-DEV] LSB forward_static_call() From: stas@zend.com (Stanislav Malyshev) Hi! > why would anyone need that? To use function that does use static without dependence on in which context if was called (or, explaining it other way, when your chain of inheritance serves multiple purposes): class ActiveRecord { static function getRow($condition) { $table = new Table(get_called_class()); return $table->find($condition); } } class Users extends ActiveRecord { } class DepartmentUsers extends Users { static function find($user) { if(self::user_in_department($user)) { return parent::getRow("user=$user"); } return false; } } $user = DepartmentUsers::find("bob"); Now in this case if your way is implemented, ActiveRecord would try to find table for DepartmentUsers, which probably does not exist. You would have to name Users by name there to do what this code wants to do, which leads us back to "why we have parent:: at all" argument. > "parent" is related to inheritance and it is logical, that it retains > call-chain. It is "logical" if you look at it with the narrow point of view of what you need for your particular application. However, there are other use cases. Automatic forwarding may become very awkward if you have multiple levels of inheritance not all of them used for the same thing. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com