Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21011 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67184 invoked by uid 1010); 2 Dec 2005 16:43:59 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 67169 invoked from network); 2 Dec 2005 16:43:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Dec 2005 16:43:59 -0000 X-Host-Fingerprint: 64.253.207.194 miami194.us.univision.com Received: from ([64.253.207.194:8550] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 21/E5-14828-FC970934 for ; Fri, 02 Dec 2005 11:43:59 -0500 Message-ID: <21.E5.14828.FC970934@pb1.pair.com> To: internals@lists.php.net References: <8F.C6.14828.4DAFF834@pb1.pair.com> Date: Fri, 2 Dec 2005 11:43:28 -0500 Lines: 66 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 X-Posted-By: 64.253.207.194 Subject: Re: [PHP-DEV] phpnamespaces.org! From: jrhernandez05@gmail.com ("Jessie Hernandez") Hello Ron, ""Ron Korving"" wrote in message news:8F.C6.14828.4DAFF834@pb1.pair.com... > I assume ::: is being used because it simply works and the discussion on > which seperator to use might still go on for some time ;). You have a point > about import statements being allowed only in the beginning. This would be > nice: > > class X > { > public function foo() > { > import class bar:::MyClass; > $obj = new MyClass(); > $obj->doSomething(); > } > } > > This would be nice, because __autoload() only needs to be called if my > method foo() is being called. bar:::MyClass is not a dependency for the > whole file, but only for X::foo(). Performance-wise it would be a good thing > if importing namespaces would not extend the dependency to the whole file. > Also, it could prevent unnecessary aliasing: > __autoload is not called at the time of import, only when the alias is actually used, so there are actually no performance issues here. > class X > { > public function foo() > { > import class bar:::MyClass; > $obj = new MyClass(); > $obj->doSomething(); > } > > public function fubar() > { > import class bla:::MyClass; > $obj = new MyClass(); > $obj->doSomething(); > } > } > > In this example, bar:::MyClass and bla:::MyClass are used. Two different > classes, each in their own namespace. Aliasing is not required, because the > imported namespaces are limited to the scope of the methods foo() and > fubar(). > Do we really want this? Since there is no performance improvement having imports be block-scoped, this really is not needed. IMO, it can also create confusion, as the same alias means different things in different contexts of the file. Regards, Jessie