Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16281 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24040 invoked by uid 1010); 18 May 2005 16:41:23 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 98102 invoked from network); 18 May 2005 16:27:31 -0000 Received: from unknown (HELO pb1.pair.com) (127.0.0.1) by localhost with SMTP; 18 May 2005 16:27:31 -0000 X-Host-Fingerprint: 81.97.205.128 spc1-hava1-4-0-cust128.cosh.broadband.ntl.com Linux 2.5 (sometimes 2.4) (4) Received: from ([81.97.205.128:34807] helo=waiter.telford.lan) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id F7/96-01538-2FC6B824 for ; Wed, 18 May 2005 12:27:31 -0400 Received: from [192.168.0.30] (unknown [192.168.0.30]) by waiter.telford.lan (Postfix) with ESMTP id A41F4390257; Wed, 18 May 2005 17:27:28 +0100 (BST) Received: from 127.0.0.1 (AVG SMTP 7.0.308 [266.11.12]); Wed, 18 May 2005 17:27:25 +0100 Message-ID: <428B6CED.3030101@ntlworld.com> Date: Wed, 18 May 2005 17:27:25 +0100 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Wez Furlong Cc: Lukas Smith , internals@lists.php.net References: <20050518132615.55570.qmail@lists.php.net> <428B40D7.8030903@php.net> <4e89b426050518083848d9a25@mail.gmail.com> <428B636F.1050902@ntlworld.com> <4e89b4260505180918bea381e@mail.gmail.com> In-Reply-To: <4e89b4260505180918bea381e@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Allow PDO::query() to return a subclass of PDOStatement From: nick.telford@ntlworld.com (Nicholas Telford) Wez Furlong wrote: >parent::method() should work, but the point is that if you add a foo() >method in a class that extends PDO, at a time where there is no >PDO::foo(), and you make it work in a particular way, and 6-18 months >later, when PDO::foo() gets added and does something totally >different. Now, someone else is consuming your library and hasn't yet >used your foo() implementation, they read the PDO manual and spot the >official PDO::foo() method and wonder why it doesn't work right. > >Even more of a headache is that drivers can magically add methods to >the namespace; different methods may be present on an instance (via >call overloading) depending on which driver is in use. These are not >visible via reflection. > >This is a classic namespacing problem. We've solved this internally >be forcing drivers to prefix their methods with the driver name. Any >non-prefixed method names are reserved for future use by PDO. > >If you don't follow this guideline, your code is officially broken :-) > >--Wez. > Unless the developer of said library realised this problem and decided to prefix all his/her methods with something unique :-P I understand what you're saying, and it is a bit of a problem, however, it's something that other Object-Oriented languages must also suffer when users decide to subclass a built in class, or even one from an external library. In fact, this problem would be present anywhere where someone would be subclassing a class that is not under their direct control. So I guess the moral of the story is, it's possible, just be careful with method naming :-)