Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26476 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56976 invoked by uid 1010); 10 Nov 2006 17:55:19 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 56961 invoked from network); 10 Nov 2006 17:55:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Nov 2006 17:55:19 -0000 Authentication-Results: pb1.pair.com header.from=news@sea.gmane.org; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php-php-dev@m.gmane.org; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain m.gmane.org designates 80.91.229.2 as permitted sender) X-PHP-List-Original-Sender: php-php-dev@m.gmane.org X-Host-Fingerprint: 80.91.229.2 main.gmane.org Linux 2.5 (sometimes 2.4) (4) Received: from [80.91.229.2] ([80.91.229.2:38814] helo=ciao.gmane.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B0/83-27611-30DB4554 for ; Fri, 10 Nov 2006 12:55:17 -0500 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Giaag-0003Br-RF for internals@lists.php.net; Fri, 10 Nov 2006 18:54:59 +0100 Received: from 115.84-48-233.nextgentel.com ([84.48.233.115]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Nov 2006 18:54:58 +0100 Received: from sb by 115.84-48-233.nextgentel.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Nov 2006 18:54:58 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: internals@lists.php.net Date: Fri, 10 Nov 2006 18:54:35 +0100 Lines: 51 Message-ID: References: <4554AE0D.4080600@caedmon.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 115.84-48-233.nextgentel.com User-Agent: Thunderbird 2.0a1 (X11/20061109) In-Reply-To: X-Enigmail-Version: 0.94.1.0 Sender: news Subject: Re: [PHP-DEV] Namespaces in PHP 6 - ++$take From: sb@sebastian-bergmann.de (Sebastian Bergmann) Ilia Alshanetsky wrote: > If anything it'll make code complex and intertwined, introduce serious > scope issue most people have not had to consider up until now and so > on. It will without a doubt increase language complexity as well, which > generally translates to a loss in performance. Am I right to assume that both scoping and performance issues only come up if we were to implement an import() mechanism? If so, do we really need import? If not, then namespace foo { class bar { } } would be "mangled" at compile-time into foo\bar and should not impose any performance penalty or scoping issues. Not having an import() mechanism, however, would mean that the user of a namespaced package has to use "fully qualified" class names (like foo\bar, for instance) while the developer of the namespaced package can (and should) use the "relative" class name. We would still get two benefits out of this: - The developer of a package does not need to worry that his class (or constant, function) names clash with his package's users. - The developer of a package can shorten the class names inside his namespaced package significantly. PHPUnit_Framework_TestCase {} would become namespace PHPUnit { namespace Framework { class TestCase {} } } Classes inside PHPUnit\Framework could refer to the class as just TestCase, classes inside PHPUnit as Framework\TestCase, and classes outside PHPUnit as PHPUnit\Framework\TestCase. -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69