Hacker News new | ask | show | jobs
by mzarate06 5358 days ago
Namespaces, as others have mentioned. The first question I had when I first encountered that as the Namespace operator was: "Why not the double colon operator?"

Double colon is already being used for static member referencing, and in a few talks I've heard from Rasmus, they weren't able to find a way to overload it for Namespaces.

Another option that was discussed was a triple colon operator, which most were opposed to b/c of it's length. I personally think the backslash is ugly, and I kind of like the triple colon operator better b/c of it's similarity to the double colon operator. Regardless of which one is prettier, I wish the double colon operator could have been overloaded.

3 comments

IIRC, the reasoning against double colons was that if you had a class and a namespace with the same name, it's impossible to tell whether SomeThing::Do() is calling a function in the SomeThing namespace, or the static Do function on the SomeThing class. One could argue that they could simple not allow namespaces and classes to share names, but I guess they didn't like that idea, either.

I hope I'm stating this right, I must admit it's from a fuzzy recollection.

> the backslash is ugly

Not only that, it's very unconfortable to type in some international keyboard layouts.

If you're talking about the German layout and AltGr, then so are the []{} keys, which are already used quite a lot in PHP programming.

It's the main reason why, even though my phyiscal keys are in German layout, I still have the USA layout in software. It's just nice to be able to make [] with a single key press :)

Agreed. Although function-¥ does give my hands a stretch now and then, I don't want to be typing it constantly..
They are harder (than many other commonly used characters) to distinguish from regular text as well.