Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25083 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7142 invoked by uid 1010); 1 Aug 2006 18:49:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 7127 invoked from network); 1 Aug 2006 18:49:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Aug 2006 18:49:05 -0000 X-PHP-List-Original-Sender: ceo@l-i-e.com X-Host-Fingerprint: 67.139.134.202 o2.hostbaby.com FreeBSD 4.7-5.2 (or MacOS X 10.2-10.3) (2) Received: from ([67.139.134.202:1263] helo=o2.hostbaby.com) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 8A/B7-45114-022AFC44 for ; Tue, 01 Aug 2006 14:49:05 -0400 Received: (qmail 22285 invoked by uid 98); 1 Aug 2006 18:49:04 -0000 Received: from 127.0.0.1 by o2.hostbaby.com (envelope-from , uid 1013) with qmail-scanner-1.25 ( Clear:RC:1(127.0.0.1):. Processed in 0.080323 secs); 01 Aug 2006 18:49:04 -0000 X-Qmail-Scanner-Mail-From: ceo@l-i-e.com via o2.hostbaby.com X-Qmail-Scanner: 1.25 (Clear:RC:1(127.0.0.1):. Processed in 0.080323 secs) Received: from unknown (HELO l-i-e.com) (127.0.0.1) by localhost with SMTP; 1 Aug 2006 18:49:04 -0000 Received: from 67.108.68.40 (SquirrelMail authenticated user ceo@l-i-e.com) by www.l-i-e.com with HTTP; Tue, 1 Aug 2006 13:49:04 -0500 (CDT) Message-ID: <26990.67.108.68.40.1154458144.squirrel@www.l-i-e.com> In-Reply-To: References: <44C09BE7.2010105@metropolis-ag.de> Date: Tue, 1 Aug 2006 13:49:04 -0500 (CDT) To: internals@lists.php.net Reply-To: ceo@l-i-e.com User-Agent: Hostbaby Webmail MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: Re: [PHP-DEV] RfC: rethink OO inheritance strictness From: ceo@l-i-e.com ("Richard Lynch") On Fri, July 21, 2006 4:30 am, Derick Rethans wrote: > On Fri, 21 Jul 2006, Mike Bretz wrote: > >> Michael Wallner wrote: >> > mike@honeybadger:~/build/php-unicode-debug$ cli >> > -d"error_reporting=8191" -r 'class c{function f(){}} class d >> extends >> > c{function f($a){}}' >> > Fatal error: Declaration of d::f() must be compatible with that of >> > c::f() in Command line code on line 1 >> > >> > >> > I *really* think that this enforcements are no good idea and I >> _beg_ >> > you that we leave this "area" to interfaces. >> +1 >> >> In real live "C++" world I often have parent classes with function >> f() >> and an extended class which also uses the function name f(..) but >> with >> other, possibly class specific, variables, which then calls parent >> f()... I do not see a good reason to enforce that both functions >> must be >> exactly the same when extending, especially since c::f() does not >> get >> called automatically, _when_ overwriting it in class d. > > It's quite a different thing in C++ as there you have method > overloading > which PHP doesn't have. Therefore your argument doesn't hold here as > they are simply *two different* methods, and not an overriden one. In > your code that uses the derived class you can still use both methods > (one without, and the one with parameters). So what exactly is the purpose of enforcing the same args here? Does it make the C code under the hood simpler? Does it make PHP an order of magnitude faster? I'm honestly just sitting here asking myself WHY anybody wants this, and not finding any benefit at all. Obviously somebody somewhere thinks it's a Good Idea for some reason. Is this how Java works, and the reasoning is to be more like Java? Is it just an Ideal that any given method should always take the same args in the "keep it simple stupid" idealogy (sp?) of PHP? I don't have a "problem" with these answers: I truly just want to understand the driving motive behind PHP's direction in OOP choices. Thanks for any clarification. -- Like Music? http://l-i-e.com/artists.htm