Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25150 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69169 invoked by uid 1010); 2 Aug 2006 21:09:37 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 69152 invoked from network); 2 Aug 2006 21:09:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Aug 2006 21:09:37 -0000 X-PHP-List-Original-Sender: mp@webfactory.de X-Host-Fingerprint: 195.227.108.51 wfserver02.wf-ppr.de Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222) Received: from ([195.227.108.51:26633] helo=wfserver02.wf-ppr.de) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id E2/98-44390-E8411D44 for ; Wed, 02 Aug 2006 17:09:36 -0400 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Wed, 2 Aug 2006 23:09:28 +0200 Message-ID: <00A2E2156BEE8446A81C8881AE117F193C334A@companyweb> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] RfC: rethink OO inheritance strictness Thread-Index: Aca2NXfQ63ya9DkbTti4QEHcAnuslQAAKA2AABBexsA= To: "Soenke Ruempler" , "Zeev Suraski" , "Rasmus Lerdorf" Cc: , , "Christian Schneider" Subject: RE: [PHP-DEV] RfC: rethink OO inheritance strictness From: mp@webfactory.de ("Matthias Pigulla") > From: Soenke Ruempler [mailto:ruempler@topconcepts.com]=20 > BUT let derived constructors change parameters > a) as constructors are never called from the parent, but=20 > optionally from a child class, it's completely valid IHMO=20 > b) constructors are usally not used in object aggregation /=20 > setters, but called only _ONCE_ at object creation =3D> the=20 > creating code knows the exact (sub-)class and it's constructor. You gave the reason why the restrictions don't apply for constructors (also not in PHP) and probably nobody will change that for "academic reasons" :) Constructors are the special case in OOP as you can call constructors only by instantiating classes. When using them you always refer to a concrete class and never have to deal with polymorphic subtypes (of course constructors can be overloaded in languages that support it).=20 Thus constructors are a place where differences between subtypes tend to pile up so that the LSP holds for the rest of the inherited methods. If you *want* to enforce constructor signatures PHP allows for defining them in interfaces which makes no sense from the academic pov, but may be useful when using the PHP feature of "new $classname($arg)" where you want to make sure first that "$classname instanceof ISomehowConstructable" (where instanceof must take a string as the first operand and work accordingly). Regards, Matthias