Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32884 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63681 invoked by uid 1010); 20 Oct 2007 21:27:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 63665 invoked from network); 20 Oct 2007 21:27:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Oct 2007 21:27:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=chuck@horde.org; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=chuck@horde.org; sender-id=pass Received-SPF: pass (pb1.pair.com: domain horde.org designates 66.92.78.250 as permitted sender) X-PHP-List-Original-Sender: chuck@horde.org X-Host-Fingerprint: 66.92.78.250 dsl092-078-250.bos1.dsl.speakeasy.net Received: from [66.92.78.250] ([66.92.78.250:51211] helo=technest.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 37/A9-03598-5A27A174 for ; Sat, 20 Oct 2007 17:27:03 -0400 Received: by technest.org (Postfix, from userid 33) id A1FED7F00D; Sat, 20 Oct 2007 17:26:58 -0400 (EDT) Received: from tatiana (tatiana [192.168.1.2]) by technest.org (Horde Framework) with HTTP; Sat, 20 Oct 2007 17:26:58 -0400 Message-ID: <20071020172658.1680416b83wxgv6s@technest.org> Date: Sat, 20 Oct 2007 17:26:58 -0400 To: Stanislav Malyshev Cc: internals@lists.php.net References: <20071019224202.20245u5zry52h5c8@technest.org> <471A6B32.3080401@zend.com> In-Reply-To: <471A6B32.3080401@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.2-cvs) Subject: Re: [PHP-DEV] Order of class resolution with namespaces and autoload From: chuck@horde.org (Chuck Hagenbuch) Quoting Stanislav Malyshev : > If it worked this way, you couldn't easily use global classes and =20 > old applications would be much harder to convert to namespaces. We =20 > think that using global Exception is much more frequent than =20 > defining your own Exception - and in the latter case you have the =20 > choice to name it something that is not the same as existing class, =20 > while in the latter case you do not. If you look at the various PHP 5 class libraries or frameworks, pretty =20 much all of them define an Exception for every package - =20 Zend_Db_Exception, Zend_Http_Exception, etc. Calling exception classes something other than Exception is kind of =20 like giving up on the namespace - if I have to name my classes, =20 *inside* their namespace, specially in order to avoid global class =20 names, then that seems very unintuitive. >> The other alternative would be to say that if you want to use a =20 >> global class inside a namespace you MUST prefix it with ::. I think =20 >> this is > > We consider it not the best choice. Using of global classes is =20 > ubiquitous in current applications, always requiring :: would make =20 > it very hard to convert them to namespaced code. We think it would =20 > require much more work than just having "require_once" in places =20 > when you override the internal classes. I agree. I think Greg and I have a better solution: if you want to use =20 a global class, import it. You can use :: if you want, but again I =20 will say that we are talking about code _inside_ of a namespace. It =20 would not add much conversion burden to say that if you want to use =20 global classes in a file you are adding a namespace to, then just add =20 imports for those classes. If PHP provided a PHP:: namespace with all =20 global classes in it (as aliases), then you could just do import PHP =20 and be done with it. People who wanted their namespace to be used =20 instead would just not do that. -chuck