As this message states, the new seperator for namespaces in PHP will be a backslash (\). I’ve had a brief skim over the IRC log the message mentions, and the conversation is indeed interesting. Personally, having been converted to a full OOP PHP programmer, I would’ve voted for namespaces only in classes (as classes are all I ever use nowadays…).
Evidently there are too many problems using the Paamayim Nekudotayim due to scope, and static classes and whatnot, but I don’t understand why when real programming languages such as C++ manage it fine. I have to agree with “dmitry”, I think using a backslash is ugly, and double colon is much cleaner.
What does this mean for the PHP community? Well anyone currently using namespaces will have to fix their code, and anyone not using namespaces will have to get used to using the backslash separator. Of course this change is going to ruffle a fair few feathers - people will wonder what on earth possessed them to use the backslash instead of double colon when backslashes are so ugly, and double colon is so… well… standard I suppose.
As this Slashdot post shows:
- Perl
use My::CPAN::Module qw(); my $instance = My::CPAN::Module->new("junk");
- C#
System.Windows.Controls.Listbox box = new System.Windows.Controls.Listbox(); // or using System.Windows.Controls; ListBox box = new ListBox();
- C++
ABC::bar(); // or using namespace ABC; bar();
- The New PHP
$object_instance = new My\PEAR\Module("myvar"); // or using My\Pear; $object_instance = new Module("myvar");
I doubt people will stop using PHP though. I expect people will either not use namespaces (explicitly anyway - technically they’d just be writing in the global namespace), or get used to it. But then, one must think - what if there is a big backlash against this change and PHP is just a bubble waiting to be burst? I doubt that’d happen, but it’s interesting to wonder…

