Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32603 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3707 invoked by uid 1010); 3 Oct 2007 16:10:11 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 3692 invoked from network); 3 Oct 2007 16:10:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Oct 2007 16:10:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@benjaminschulz.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@benjaminschulz.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain benjaminschulz.com from 80.81.249.139 cause and error) X-PHP-List-Original-Sender: php@benjaminschulz.com X-Host-Fingerprint: 80.81.249.139 mx.systisoft.com Linux 2.5 (sometimes 2.4) (4) Received: from [80.81.249.139] ([80.81.249.139:54338] helo=mx.systisoft.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F9/B3-23468-FDEB3074 for ; Wed, 03 Oct 2007 12:10:10 -0400 Received: (qmail 31645 invoked from network); 3 Oct 2007 14:42:03 -0000 Received: from unknown (HELO mail.ih.systisoft.com) (217.13.198.186) by mx.systisoft.com with SMTP; 3 Oct 2007 14:42:03 -0000 Received: from localhost (localhost [127.0.0.1]) by mail.ih.systisoft.com (Postfix) with ESMTP id 4218F346382; Wed, 3 Oct 2007 16:42:12 +0200 (CEST) Received: from mail.ih.systisoft.com ([127.0.0.1]) by localhost (heidi.b.ih.systisoft.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 15620-06; Wed, 3 Oct 2007 16:42:07 +0200 (CEST) Received: from [10.0.3.10] (marvin.b.ih.systisoft.com [10.0.3.10]) by mail.ih.systisoft.com (Postfix) with ESMTP id 4F26F346361; Wed, 3 Oct 2007 16:42:07 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <4703A08D.3010606@chiaraquartet.net> References: <470295DA.6090602@php.net> <4702A457.5010005@zend.com> <83C14D8F-4F6A-49C6-BE2E-2B80A722A03C@benjaminschulz.com> <4703A08D.3010606@chiaraquartet.net> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-ID: Content-Transfer-Encoding: 7bit Date: Wed, 3 Oct 2007 16:42:04 +0200 To: Gregory Beaver , internals Mailing List X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: by amavisd-new at mail.ih.systisoft.com X-Spam-Status: No, hits=-2.638 tagged_above=-999 required=5 tests=ALL_TRUSTED, BAYES_00, MISSING_SUBJECT, NO_RECEIVED X-Spam-Level: Subject: Re: [PHP-DEV] Re: namespaces: import name conflicts with defined class From: php@benjaminschulz.com (Benjamin Schulz) >> > namespace test; > class Exception {} > $a = new Exception('hi'); > ?> > > The above code works just fine. > > Yes there is a concept. import is best used within a namespace. So, > namespace your code and there is no need to import global classes. Yep, it works if your whole application uses one namespace, but what if you have a core package that defines some exceptions and another package, with a different namespace, that wants to use the core exceptions? Like namespace App; class Exception extends Exception { ... } and in another File: namespace App::Db; import App::Exception; .... This doesn't work. And worse: imagine PEAR would bring a PEAR::Exception along, PEAR would be my basic framework and i wouldn't care about ::Exception, i don't even know it's there - i am using PEAR. In every Script i would like to use PEAR::Exception in a convenient way i have to write: (Nevermind if this example doesn't fit the PEAR-idea, just s/PEAR/ randomFramework/g then) You think this makes sense? Or what about this: pear/Mail_IMAP/IMAP.php (dunno if this file exists): But how to know in advance, e.g. think about other libraries, which > public classes possibly exist? Isn't this problematic then? Let's say i PEAR would have namespaces and there is a class PEAR::DB::Mysql, i use this class as: