As I predicted last week, the much-anticipated (by me, anyway) release of PHP5.1 has been quickly followed by version 5.1.1. The new release is due in large part to problems with a new Date() class , and as a result there was a great deal of finger-pointing and name-calling on the PHP internals mailing list (some interesting insight on the issue here). That side of the debate has now tailed off, to be replaced by a rumpus about namespaces.
Namespaces allow the developer to create ‘contexts’ for function and classes, allowing you to have more than one function or class with the same name in the same script. It seems almost certain now they will arrive in due course (either in a later version of PHP5 or, more likely, in PHP6), and almost everyone agrees that they’ll be mighty useful. But of course, nothing is simple is PHP-land, and now a row has blown up over what seperator to use.
Java, and a number of others, use dot notation (eg. java.io.File) but PHP uses the . for concatenation so that’s out. Various option have been suggested, with the leading contenders being a single colon : and the backslash symbol \. The former potentially causes problems with the ternary operator, while the latter (to my eyes, at least) just looks a bit weird.
Someone suggested something along the lines of :> — which looks odd to start with but makes sense to me, since PHP uses -> as a seperator in classes. However, this post from Oliver Gratz suggests that some combination of colons could well be the final choice. Ooh, it’s like Pop Idol.
[Update] I very much doubt he reads this blog, but by some weird coincidence Andrei Zmievski just posted an article entitled This Is Not “American Idol” …
[Update] Wow, there’s now an entire site devoted to the implementation of namespaces in PHP. How…odd.