PHP is (most presumably) getting namespaces

  • Christian Stocker

If you're not subscribed on the internals mailinglist of PHP, you may have missed a (most of the time very ridiculous) discussion about namespaces in PHP. The important part of the whole discussion is, that it looks like PHP 6 is getting namespaces. I don't care that much about namespaces, I prefix my classes anyway, but it's a nice to have certainly.

The annoying part of the discussion (with dozens of redundant posts) was about which namespace separator should be used. The proposals went from ~> to }{ to :> and other funny combinations and someone even started counting the votes and making a big table of his interpretation what the people said… You have to keep in mind, that there are usually no votes on internals, but conclusions are tried to be made by consensus.

Anyway, at the end it boils down to either :: or ::: or as separator, the double colons have some technical limitations, the backslash looks somehow strange, but I think, one could get used to it. How this would look like (nested namespaces are possible):

name1:::name2:::class::func();

name1name2class::func();

The ::: is really hard to parse IMHO, so I'd prefer , even though it's usually the escaping character. But I'm not the one to decide in that matter (neither are most of the people who have flooded the mailing list in the last few days…)


Tell us what you think