single colon allowed in identifiers
| From: | Greg Beaver | Date: | Tue, 15 Apr 2003 04:47:43 +0000 |
| Subject: | single colon allowed in identifiers | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-921@lists.php.net to get a copy of this message | ||
Hi,
I've been thinking about the allowance of a single colon as syntactic sugar, and have several considerations to raise:
-This code is VERY confusing and should be legal:
namespace my:confusion {
define("test",6);
}
namespace my {
class confusion {
const test = 6;
}
}
$a = (new my::confusion ? my:confusion::test : my::confusion::test);
-the #1 question on php.pear.general will become "I tried to use PEAR::Package_Name::Class_Name and it didn't work! Why?"
Is it absolutely necessary to prevent the nesting of namespaces, to allow sub-packaging like PEAR::Package_Name? This sub-packaging is a very active part of how PHP is actually being used, and would make a great deal of sense.
If the above possibility is out of question, I am strongly in favor of removing the confusion of allowing a single colon. The underscore works just fine (PEAR_Package_Name::Class_Name)
Thanks,
Greg