Slashdot Mirror


PHP Gets Namespace Separators, With a Twist

jeevesbond writes "PHP is finally getting support for namespaces. However, after a couple hours of conversation, the developers picked '\' as the separator, instead of the more popular '::'. Fredrik Holmström points out some problems with this approach. The criteria for selection were ease of typing and parsing, how hard it was to make a typo, IDE compatibility, and the number of characters."

25 of 523 comments (clear)

  1. Going back to DOS style... by joaommp · · Score: 5, Funny

    ... and comming full circle.

    1. Re:Going back to DOS style... by joaommp · · Score: 5, Funny

      Jeez, take a joke as it is, will you?

    2. Re:Going back to DOS style... by eulernet · · Score: 2, Funny

      Scroll your screen to see the animation:

      \
      -
      /
      |

  2. Can\'t read summary by jspenguin1 · · Score: 5, Funny

    I couldn\'t read the summary because it had an unterminated string literal.

  3. But in PHP for Windows by Anonymous Coward · · Score: 5, Funny

    It'll be /, just to keep things interesting.

    1. Re:But in PHP for Windows by Anonymous Coward · · Score: 1, Funny

      I thought they chose \ to make windows users feel like at home..

  4. Re:what wrong with by FooAtWFU · · Score: 2, Funny
    Slashcode runs off of Perl. They must hates it with a passion.

    [sic]

    --
    The World Wide Web is dying. Soon, we shall have only the Internet.
  5. Re:A long overdue addition by FooAtWFU · · Score: 5, Funny

    I will happily adjust myself in this ONE manor

    While you're livin' it up at your stately manor, I'm coding PHP out of my garage, you insensitive clod!

    --
    The World Wide Web is dying. Soon, we shall have only the Internet.
  6. Backslash! by SEWilco · · Score: 3, Funny

    Just make sure they name it a backslash in the documentation, not a slash.

  7. Well now we all know what trouble this is going .. by 3seas · · Score: 4, Funny

    ... to cause for windows servers...

    imagine what directories will be deleted due to a typo!

  8. Re:The BASIC of the 21st century by Dragonslicer · · Score: 5, Funny

    PHP is far from dead. PHP5, with support for real OO, was a huge improvement. There's been a lot of hard work put in to PHP in the last few years to make it a much more viable modern programming language.

    Then I see people suggesting \ for a namespace separator, and I wonder what happened to all the people that put so much work into making PHP5 good, and why we can't get them back.

  9. Re:yet another wtf by Mental+Maelstrom · · Score: 2, Funny

    AltGr + Plus [the key right of number 0] on Estonian layout also. This is so discriminatory! :P

    We should use a character present on most keyboard layouts. I propose the use of the Space-key for this purpose.

  10. Today is a Wonderful Day by redink1 · · Score: 5, Funny

    The number of days that an old, crusty Perl developer can laugh at another language are few and far between.

    Thank you, PHP.

  11. Re:Well, That Does It! by TheRaven64 · · Score: 1, Funny

    There are lots of valid reasons for hating any given language, but syntax is rarely one of them. (Lisp excepted)

    --
    I am TheRaven on Soylent News
  12. Re:Well, That Does It! by Anonymous Coward · · Score: 1, Funny

    You mean "language\runtime\interpreter\parser\scanner".

  13. Re:HOLY FUCKING SHIT!?!?! by mweather · · Score: 1, Funny

    Yeah, you don't need insight to know the developers were high as a kite.

  14. Re:WTF? by moderatorrater · · Score: 2, Funny

    When are you going to use the escape character outside of a string? I agree that it's dumb, and it's going to make for ugly looking code, but saying that it shouldn't be used because it's an escape character seems like an empty criticism. It's like saying that Elisabeth Taylor's personal life is messed up because she doesn't pay enough attention to her hair.

  15. Re:The BASIC of the 21st century by faraway · · Score: 2, Funny

    I don't do minor upgrades, there are other people for that. When a major upgrade is needed, let's say from version "2.7" to "3.0" they call me.

    Wow. So you're the guy that does those small changes huh? They usually call me for "3" to "4". I write it all in machine language for optimized speeds and job protection.

  16. What about Eval? by coryking · · Score: 3, Funny

    Now do you have to escape your namespaces before passing them through eval?

    eval("$instance = new My\\Super\\Class(\"blah\"););

    Since they now are using the escape character for namespaces, I wonder what kinds of security implications this might have? What happens when a PHP program for some reason evals() some user input that doesn't properly escape the namespaces?

  17. Easy to fix this by sfjoe · · Score: 5, Funny

    Since PHP is open source, someone will make a fork with a different separator and the dumber of the two choices will wither away.

    --
    It's simple: I demand prosecution for torture.
  18. Re:Easier on which keyboard layout? by Anonymous Coward · · Score: 1, Funny

    Never mind. I won't call you.

  19. Re:HOLY FUCKING SHIT!?!?! by Anonymous Coward · · Score: 1, Funny

    I understand they messed up parsing foo::bar as one method... so why not just do namespace:::foo::bar ? ::: is still far from standard, but less god awful than "\".

    If ::: means something in the PHP universe (I set the language down years ago), then they could do ":.:" and make both C# and Perl programmers happy in one swoop!

  20. Re:The BASIC of the 21st century by Saint+Stephen · · Score: 3, Funny

    in other words you're incapable of maintaining code and you rewrite the same thing for them in a different language...

  21. Oblig. Bender by OldManAndTheC++ · · Score: 2, Funny

    Yeah, screw those guys! I'll make my own PHP -- with blackjack! and hookers!

    --
    Soylent Green is peoplicious!
  22. Re:PHP sucks, but it has a very important niche by alien_life_form · · Score: 2, Funny

    In fact, not to start a language war, I think his language of choice should be Perl.

    Cheers,
    alf