UltraSimple Namespace Solution
| From: | Nathan Rixham | Date: | Fri, 17 Oct 2008 10:53:40 +0000 |
| Subject: | UltraSimple Namespace Solution | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-41209@lists.php.net to get a copy of this message | ||
*The Problem (as defined by Greg):*
foo.php:
<?php
namespace one::step;
function two(){}
namespace one;
class step {
static function two(){}
}
?>
main.php:
<?php
include 'foo.php';
// is this class one::step or namespace one::step?
one::step::two();
?>
*A Simpler Solution*
Force userland / general naming conventions in PHP.
# namespaces are always lowercase
# functions are always lowercase
# classes are always CamelCaps with initial uppercase letter enforced
thus:
//this is always the function two in namespace one::step
one::step::two();
//this is always the method two of class step in namespace one
one::Step::two();
thoughts, opinions, reasons why it wouldn't work?
regards,
nathan