Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8343 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3179 invoked by uid 1010); 3 Mar 2004 13:33:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 3155 invoked from network); 3 Mar 2004 13:33:18 -0000 Received: from unknown (HELO sys07.mail.msu.edu) (35.9.75.107) by pb1.pair.com with SMTP; 3 Mar 2004 13:33:18 -0000 Received: from 66-65-38-153.nyc.rr.com ([66.65.38.153] helo=chiaraquartet.net) by sys07.mail.msu.edu with asmtp (Exim 4.24 #37) (TLSv1:AES256-SHA:256) id 1AyWUv-0006Li-T2; Wed, 03 Mar 2004 08:33:17 -0500 Message-ID: <4045DE9D.3050107@chiaraquartet.net> Date: Wed, 03 Mar 2004 08:33:17 -0500 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rob Richards CC: internals@lists.php.net References: <014501c400be$2190f1f0$f7dea8c0@cyberware.local> <4045553C.3080309@chiaraquartet.net> <018301c4010f$65ffd9e0$f7dea8c0@cyberware.local> In-Reply-To: <018301c4010f$65ffd9e0$f7dea8c0@cyberware.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus: None found by Clam AV Subject: Re: [PHP-DEV] Re: more static method fun From: greg@chiaraquartet.net (Greg Beaver) Hi Rob, Rob Richards wrote: >From: Greg Beaver > > > >>The PEAR base class also has this design flaw in several methods. It >>has caused nothing but annoying and unfixable bugs. The only good >>solution is to redesign by splitting the methods into two methods, one >>static, one not. It's best to do this before the stable label is >>applied, unless you like getting the same valid bugs reported over and >>over with different permutations :) >> >> > >Say dom load were split into 2 methods (this is not something that should be >required to do). One static and one a regular public function. As shown with >the simplexml example, the regular function would still not work correctly. >The method I used in that example, is not a static method, but if called >within another class method, it is allowed to be called using the static >syntax > To quote Microsoft, "this is a feature, not a bug." :) Of course, if someone tries to call a non-static method from another completely unrelated class, that's just stupid. But there are cases where you might want to call a method from a parent class 2 levels up. class one { function doSomething() {} } class two { function doSomething() {} } class three { function doSomething() { $a = one::doSomething(); } } Here, it's perfectly logical to allow :: as it is in fact not a static method call. If PHP removes this feature, it will break a lot of code I've written that has been working in a production environment for the past 2 years without a single glitch. I've also written code to emulate runtime multiple inheritance that relies upon using a method from another class that expects certain properties to be available in the class, and this works great. There is a certain amount of control that PHP can enforce, but in this case, I think it's up to the programmer's intelligence to understand how class hierarchies work, and not write code that fails. One point you raised that is significant to me is the crash, I don't think it's all that good that PHP 5 crashes instead of failing with some kind of fatal error. Greg