Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25100 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62803 invoked by uid 1010); 2 Aug 2006 06:56:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 62787 invoked from network); 2 Aug 2006 06:56:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Aug 2006 06:56:58 -0000 X-PHP-List-Original-Sender: ruempler@topconcepts.com X-Host-Fingerprint: 62.116.172.149 mail.city-map.de Linux 2.6 Received: from ([62.116.172.149:45404] helo=mail.city-map.de) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id DA/AD-45114-70840D44 for ; Wed, 02 Aug 2006 02:36:57 -0400 X-AuthUser: stademailin@mail.city-map.de Received: from mail.topconcepts.net by mail.city-map.de ([62.116.172.149]:25) with [XMail 1.22 ESMTP Server] id for from ; Wed, 2 Aug 2006 08:36:50 +0200 Received: from sky.stade.topconcepts.net by mail.topconcepts.net with [XMail 1.22 ESMTP Server] id for from ; Wed, 2 Aug 2006 08:36:49 +0200 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Wed, 2 Aug 2006 08:36:48 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] RfC: rethink OO inheritance strictness Thread-Index: Aca1m6u+/xyuaGJJSZGUPeVK6Mq/dwAXjpigAAClrKA= To: "PHP Developers Mailing List" Subject: RE: [PHP-DEV] RfC: rethink OO inheritance strictness From: ruempler@topconcepts.com ("Soenke Ruempler") Hi, just forwarding this (with some little correction in the sample code) to the dev list as the discussion seems not to be finished ;) The only thing I don't like is the BC breakage from 5.1 =3D> 5.2. Maybe = an idea of a strict mode like Lukas mentioned is some alternative. Richard Lynch wrote on Tuesday, August 01, 2006 8:52 PM: > On Fri, July 21, 2006 6:05 am, Soenke Ruempler wrote: >> So maybe from your POV it's two different methods (and yes, it IS >> *technically*). But from OOP and API design view it is polymorphism >> and consistency, if I didn't failed all OOP lessons and design >> pattern books ;) >=20 > Errrr. Isn't that what an interface is supposed to be for?... For object aggregation it is - yes. > To define a "pattern" which implementations much adhere to? Checkout the template method pattern. Or in general, hooks for subclasses: class A { public function doSomething() { $this->someHook('blah'); } protected function someHook($someString) { // Empty hook } } class B extends A { protected function someHook($someString) { echo $someString; } } $c =3D new B; $c->doSomething(); Now A relies on B's correct definition of method someHook(). > Why are you cramming that into a class definition, when no other > language does that?=20 Other languages have parameter polymorphism where you can declare the same method several times with different parameters. PHP doesn't. -soenke