Linked by Thom Holwerda on Fri 16th Jan 2009 09:52 UTC
General Development The concept of Namespaces provides a way to help avoid problems with multiple functions, classes, and constants of the same name being defined multiple times. PHP 5.3 borrows much of the syntax and design of Namespaces from other languages â€" most notably C++. However, it does deal with Namespaces in a somewhat unique way, which may cause problems for those familiar with Namespaces. This article takes a close look at PHP V5.3 namespaces, which is one of the most anticipated and the most debated feature in this release of PHP.
Thread beginning with comment 343974
To read all comments associated with this story, please click here.
Here come the trolls
by Nycran on Sat 17th Jan 2009 11:33 UTC
Nycran
Member since:
2006-02-06

It never ceases to amaze me that every time there's a PHP article on OS news, a bunch of people come into the thread who clearly don't like PHP, with the sole intention of bad mouthing it rather than contributing to any useful conversation. It would be nice, if just for once, people stayed on topic.

At first I thought the back slash was a bit ugly, but really it's no different from what some file systems use to separate levels of folders.

Folder\File

Namespace\Function

I think we just need to get used to it.

RE: Here come the trolls
by siride on Sat 17th Jan 2009 16:11 in reply to "Here come the trolls"
siride Member since:
2006-01-02

The problem is that the convention does not fit within PHP. In PHP, backslash has always meant escape character, as it does in many other C-like languages. To separate components of objects and such, you always use either :: or ->. This is also the convention in other languages. So when it's time to choose the separator for namespaces, the PHP developers, as usual, go and pick the one WRONG way to do it and go with the backslash, which makes no sense in any convention and looks ugly to boot (Windows is the only OS which stupidly uses backslashes as path separators anyways, that's hardly a system I'd want to follow).

There's a reason people badmouth PHP. Actually, a lot of reasons. The developers consistently eschew solid design and convention in favor of a series of "how can we do this least correctly" decisions. I develop with PHP all day. And every day, I run into the stupidity just trying to do basic things. Every day, I have to go read parts of the manual over again to remember which random ordering of arguments I should use for a given string function. Every day I deal with strange inconsistencies in the language, poor OO implementation and performance issues.

Reply Parent Bookmark Score: 2

RE[2]: Here come the trolls
by systyrant on Sun 18th Jan 2009 18:44 in reply to "RE: Here come the trolls"
systyrant Member since:
2007-01-18

Then why use it? Lot's of other languages out there.

That's a rhetorical question by the way. I know why most people use PHP professionally. To make money and because a lot of web programming is now done in PHP. I'm sure lot's of other reasons exist as well.

What amazes me most is how many people dislike PHP (according to forum post and not statistics) yet program with it everyday. I use PHP (drupal fan), but I'm by no means an expert or anything like that.

Oddly I seem to read a lot of bad things about every language. Seems no language is satisfactory. Everybody wonders what those silly language developers were thinking when they did that stupid crap.

For the record. I think the PHP developers could have come up with something a little more elegant than a backslash, but honestly those who program in PHP daily will get use to it. Like it or not. Every programmer I know worth his weight gets use to the quarks of the language they use most. Sure they bitch about it for awhile, but in the end it's just another moot point.

Reply Parent Bookmark Score: 2