Escape from Namespaces

I admit that I am an unproductive whiner on this issue. I don’t care if namespaces go into PHP or not; at this point, I’d almost rather they not. But some of my feelings as expressed on IM this morning:


09:13:08  pmjones: yay\for\new\namespace\separator
09:13:12  pmjones: hmmmm
09:13:19  nate: oh geez
09:13:27  nate: I can't believe they picked *that* one
09:13:33  pmjones: does that mean there are two newlines in that phrase?
09:13:36  pmjones: who knows.
09:13:53  nate: you should really post something like that
09:14:01  pmjones: maybe PHP really *is* getting bought by Microsoft
09:14:12  nate: yeah
09:14:17  nate: you'd have at least thought they'd go with /
09:14:31  pmjones: no, that's division
09:14:38  pmjones: which might make sense, now that i think about it
09:14:47  pmjones: for all the divisiveness we have over it
09:14:51  nate: heh ;-)
09:14:59  nate: you took the words out of my mouth
09:15:03  nate: er, fingers
09:15:06  pmjones: indeed
09:15:16  pmjones: i know you want namespaces very badly ...
09:15:23  pmjones: ... but do you want them *this* badly?
09:15:45  nate: still undecided
09:16:00  pmjones: if you want them badly, badly is what you've got ;-)

To explain the jokes:

The “\n” characters in the namespace string are escaped newlines; thus, “yay\for\new\namespace\separator” might well be translated as “yay\for[newline]ew[newline]amespace\separator”. ASCII gurus will know what \f and \s translate to.

Zend Is Not PHP, so Microsoft can’t buy “PHP”. But the backslashes are very DOS-ish.

Here ends the unproductive whining, at least for now.

This entry was posted in PHP. Bookmark the permalink.

15 Responses to Escape from Namespaces

  1. Sean Coates says:

    And I must direct you to my only post to PHP Internals in 2008:

    http://news.php.net/php.internals/41458

    S

  2. pmjones says:

    @Sean: fair enough. :-)

  3. James says:

    Lets just bin PHP and use Python. It does namespaces properly.

  4. zaa says:

    Ninh summed it up quite nicely :-)
    http://ninh.nl/blog/2008/10/25/a-word-on-phps-upcoming-namespace-seperator/

    “As mentioned before, C++ also uses the “::” as a means to denote a namespace separator. Like PHP (or actually, the other way around), it also uses the “::” for static class member access. So doesn’t C++ have to deal with the same problem then?

    The answer to this question is no. Even though in a similar situation, it is also bound to suffer from the same ambiguity problem, the compiler will just simply tell the programmer that that particular symbol has already been defined.”

  5. I still maintain that ¬ would be ideal.

  6. Sigh. Using the escape operator for another purpose … I really want namespaces in PHP, but I have to agree with you Paul that we have them badly.

  7. rodrigo moraes says:

    I’d like to have :-D as separator, because it’d really fit my happiness when working with Solar. Think on “Solar :-D Sql”: it’d be perfect!!!

    hmmm, ok, i’ll be quiet now.

  8. Chekke says:

    PHP blows!!, I’ll move to Python.

  9. Ren says:

    \ is indeed bad.

    But people suggesting using Python where white space is significant.. is far far worse, imo.

  10. Pingback: Finally namespaces

  11. Pingback: php namespace seperator, alternative? | Jenkins-Web

  12. kvz says:

    Nicely put.

  13. Robert Treat says:

    Yeah, the DOS angle does kind of stick out… see my tweet on the subject http://twitter.com/robtreat2/status/976197774 (sound it out)

  14. Rob Graham says:

    The \ (escape) character is only an escape character when it’s in a string, I’ve not looked but the namespace declaration is probably not surrounded in quotes. Personally I cannot wait for namespaces all this My_Package_Is_Called_This_SoThere is doing my head in.

  15. Les says:

    Yes…

    The whitespace in Python is a killer for me too, far too much hassle for me to use it over PHP.

    But just what are we going to do about this namespace separator? The backslash is complete and utter horse manure, and the individual responsible needs to hang their head in shame.

    Bring back :: as that is more suitable to PHP and would someone please tell Microsoft where to go?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>