Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32885 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64899 invoked by uid 1010); 20 Oct 2007 21:28:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 64884 invoked from network); 20 Oct 2007 21:28:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Oct 2007 21:28:34 -0000 Authentication-Results: pb1.pair.com header.from=chuck@horde.org; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=chuck@horde.org; spf=pass; 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:51225] helo=technest.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DB/E9-03598-2037A174 for ; Sat, 20 Oct 2007 17:28:34 -0400 Received: by technest.org (Postfix, from userid 33) id 378F67F00D; Sat, 20 Oct 2007 17:28:31 -0400 (EDT) Received: from tatiana (tatiana [192.168.1.2]) by technest.org (Horde Framework) with HTTP; Sat, 20 Oct 2007 17:28:32 -0400 Message-ID: <20071020172832.338919lgcfp4v1us@technest.org> Date: Sat, 20 Oct 2007 17:28:32 -0400 To: Stanislav Malyshev Cc: Gregory Beaver , internals@lists.php.net References: <20071019224202.20245u5zry52h5c8@technest.org> <47196F1A.80400@chiaraquartet.net> <471A6BC6.3090608@zend.com> In-Reply-To: <471A6BC6.3090608@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.2-cvs) Subject: Re: [PHP-DEV] Re: Order of class resolution with namespaces and autoload From: chuck@horde.org (Chuck Hagenbuch) Quoting Stanislav Malyshev : >> > namespace Test; >> // explicitly tell PHP that we want Test::Exception to be autoloaded (in >> essence) >> import Test::Exception; >> >> class Tester { >> public function fail() { >> throw new Exception(); >> } >> } >> ?> > > This is even better than requiring, and makes the intent very clear. > I don't think it decreases intuitiveness, on the contrary - from the > look of the code it is immediately clear which exception would be > used. Except that it makes it unclear what happens in _other_ files, which is even worse. Once you include the file above, any other file in the Test:: namespace that throws an Exception will throw Test::Exception, not Exception, even if it doesn't import Test::Exception. I think it makes much more sense to import classes that are _outside_ the current namespace. Having to import pieces of your own namespace makes namespaces less useful and intuitive. -chuck