PHP is (most presumably) getting namespaces

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):

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…)

Double colon seems fine to me, reminds me of C++ namespaces.

Double-colons have some technical limitations (especially if namespaced functions should be allowed), ’cause they are already used for static methods.

Details on that can be found on the mailinglist (between all the noise :) ), as I’m not familiar right now with the real limitations.

If you entered the backslash in your examples it’s a nice example why it’s a bad idea. It means escaping in nearly every other context (exception windows paths *ugh*). And it seems like it got dropped by your self written blog =)


Hrhr, grrreat. You won :)

Although it’s just a bug somewhere in my Blog Tool…

IMO, they should kill off the hash mark as a commenting character because everyone knows better than to use # comments (we already have // and /* */, what more is needed?). And then use the hash for namespaces:


A dot would be nice, but ofcourse, this is used for string concatenation. Now that could easily be replaced by +, but that would raise serious backwardscompatibility issues ofcourse.

The problem is that # is already in use…

#!/usr/bin/env php


Double colons don’t necessarily have a technical limitation, and name spaces already exist, in some fashion, in PHP.

All a class is is a name-space with added functionality. This is from the origins of C & C++, where name spaces were extended to allow functions, then objectification.

I’ve even chided my boss for calling his programming object-oriented, when all he’d really done is create a few name-space classes (just a class that collects a bunch of functions, and sometimes a variable or two in his case), then *objectify* it for some ungodly reason, when everywhere he uses it it could be used statically – as a

Long-winded, I know… but basically, my argument is that name-spaces & classes use the same symbols in C++, they can & should in this case too… since classes really are just extended namespaces.

Forgive me for being new to the guts of PHP — I’ve mostly just been an avid fan of using the language.

I’ve wanted namespaces for awhile, but I ask why don’t we do the following?

1. Require string concatenation be ” . ” with a space before and after.

2. Use the “.” alone (with no space) to be the namespace separator.

3. Permit one to use “.” instead of “->” if they want to start doing that.

Perhaps item 3 might not be possible with the parser, but I would think that 1 and 2 would be.

If we did this, it would be more congruent and far easier to type with other curly bracket type languages.

As is, using “:::” seems a bit too many keystrokes. I prefer Bluefish as my IDE and it doesn’t have intellisense to automatically put that in for me. It adds to my typing.

I’ll work with whatever I’m given, but my vote is for the simple “.”