Namespace Resolution
| From: | Ryan Panning | Date: | Tue, 04 Nov 2008 17:37:12 +0000 |
| Subject: | Namespace Resolution | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-41653@lists.php.net to get a copy of this message | ||
First, I want to say thanks for determining the best separator. Even though it's not what everyone would like, it's what would work best.
Second, sorry for starting a new thread. To me, continuing the resolution discussion in the "namespace separator and whining" isn't the correct place.
Third, moderating this list may help the developers keep the noise down but user-land people, like myself, need to have some input too. Not sure if this was proposed yet but what about a "trial period" where if a person shows that they don't "over-post" they get un-moderated.
Finally, down to business. What I would like to see is that any call not prefixed with a direct namespace or not "used" at the top, be considered a global request. This forces users to either define what they are going to "use" or directly define what namespace is requested. Ex:
<?php
namespace NsA\NsB;
class ClassB {
public function methodB() {
namespace\func_b();
}
}
function func_b() {
print 'I am in NsB';} ?> <?php namespace NsA\NsB\NsC; function func_c() {
print 'I am in NsC';} ?> <?php include 'NsB.php'; include 'NsC.php'; use 'NsA\NsB\NsC\func_c()'; $obj = new NsA\NsB\ClassB; $obj->methodB(); func_c(); ?>