RFC: Namespace declaration with leading backslash
| From: | Bernhard Schmalhofer | Date: | Fri, 16 Jan 2009 12:38:31 +0000 |
| Subject: | RFC: Namespace declaration with leading backslash | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-42658@lists.php.net to get a copy of this message | ||
Hi,
I was looking at namespaces in PHP 5.3, http://de3.php.net/manual/en/language.namespaces.definition.php.
There I found myself wondering why a leading backslash in namespace declaration
is not allowed. For example:
<?php
namespace \A {
echo "in namespace \\A\n";
}
?>
I image that a trailing backslash could become a common programming error,
especially as it is required when refering to symbols with their absolute name.
<?php
namespace A {
const FOO = "This is FOO in namespace \\A\n";} namespace B {
echo \A\FOO;} ?> Best regards, Bernhard Schmalhofer