Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30955 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65534 invoked by uid 1010); 16 Jul 2007 02:12:19 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 65519 invoked from network); 16 Jul 2007 02:12:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2007 02:12:19 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.114 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.114 unknown Windows 2000 SP4, XP SP1 Received: from [63.205.162.114] ([63.205.162.114:53147] helo=us-ex1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/4B-36042-004DA964 for ; Sun, 15 Jul 2007 22:12:18 -0400 Received: from [127.0.0.1] ([192.168.17.11]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Sun, 15 Jul 2007 19:12:13 -0700 Message-ID: <469AD3F8.40109@zend.com> Date: Sun, 15 Jul 2007 19:12:08 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: Giedrius D CC: internals@lists.php.net References: <3d1a63d10707150624y2b166f33y1bf3f628aba596b2@mail.gmail.com> In-Reply-To: <3d1a63d10707150624y2b166f33y1bf3f628aba596b2@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 16 Jul 2007 02:12:14.0175 (UTC) FILETIME=[B9CA06F0:01C7C74E] Subject: Re: [PHP-DEV] Simple Namespace Proposal From: stas@zend.com (Stanislav Malyshev) > The other thing that bothers me is namespaces nesting. It was said > that namespaces > nesting is not supported. Then I'm missing a point in having namespace > named "A::B". The same reason some people write $a = f($z, $t) and some write $parsed_template = template_parser($template, $data_values) :) > Lets say I have three files: > > a.php: > namespace A; > > function foo() > { > } > ?> > > b.php: > namespace A::B; > > function bar() > { > //foo(); > } > ?> > > index.php: > require 'a.php'; > require 'b.php'; > > import A; > foo(); // should call A::foo(), right? > B::bar(); // will this call A::B::bar()? > ?> import A is a no-op. You do import A::B and then you can do B::bar. import N means "something that is named N can now be referred only by it's 'last name' last(N), last name being last segment of the long name". If you have short names, you don't need namespaces, but if you have names like PEAR::DB::Record::Type::Modifier::Exception, you probably do :) > Now if this does not work then whats the point in having namespace > "A::B" instead of "A_B"? IMHO this brings more confusion then > clearness. The point is you can a) omit namespace prefix inside namespace and b) use just B (or C if you wish) instead of A::B outside, once you did import. As I said, with long names it makes sense, with short ones you are OK without it. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com