Re: Simple Namespace Proposal

From: Date: Mon, 09 Jul 2007 17:22:05 +0000
Subject: Re: Simple Namespace Proposal
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-30684@lists.php.net to get a copy of this message
I agree, FWIW. -Andrei On Jul 9, 2007, at 12:49 AM, Stanislav Malyshev wrote:
+1 for braces. <?php function super_common_function_every_namespace_in_my_project_uses(){ } namespace A::B {
    function foo() {
      //arcana of A::B stuff
    }
} ?>
That's what I would like to avoid. Because if you need namespaces, then you want to segment your naming space. If you in the same time pollute the global space with non-namespaced function names, the whole namespace business is kind of meaningless. Or you want your library not polluting global space, or you don't. That's not the question of usage frequency - if you don't use one function and frequently use another, put them in different files for starters. And there's nothing preventing one from frequently using namespaced function - that's exactly why namespaces are proposed, to make frequent use of long names easier. That's why import exists.
If you want to document "namespaces will never be nested" from the get-go, that would be fine, of course.
I see no reason to nest namespaces - since there's no relation between Foo::bar and Foo::bar::Baz as namespaces - they are different strings. Nesting is needed only when there is a relation, and I think that's just unnecessary complication, not worth the trouble. --Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com --PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.internals (#30684) next »