That said, this article, and every other one like it, reeks of some strange belief that every single language is supposed to have all of the features of some programmer's favorite language, as well as all of the neat new trendy stuff, and if the language doesn't support all of that -- well then it's dead! Or dying. Or "a husk".
There doesn't seem to be any realization on the part of the programmer that a particular language is just a tool, usually designed for a specific application. The programmer is attempting to fit a square peg into a round hole, and they're cursing at the square peg because it doesn't fit.
Let's take one example: closures. They sounded interesting, and potentially could solve a problem in a large JavaScript library I was working on. So I got to know them, I practiced with them, I made sure I grokked them before trying to apply them. Then I put them to work, and found that they ended up making my library unnecessarily complex, that they caused some odd behaviors occasionally, and that they didn't solve any problem that I couldn't more easily solve using simpler methods.
So, does PHP's lack of this author's favorite features really make it a "husk"? No, not at all. Applications as large and complex as osCommerce don't rely on those language features; they rely on the features that the language does have, and they work just fine.
One of the most basic skills programmers need to have in their toolbox is the ability to adapt their habits according to the tools they're using. The programmers that spend their time writing blog posts like this one don't seem to have picked that up.
...Ugh, this just cost me 10 minutes that I could've spent actually working on one of my projects. :-(
My problem is that it wasn't implemented _correctly_. If you're going to implement a feature, do it right or don't do it at all. Their lack of concern or pride in their project does not bode well for the community.
I'm not a part of the community, and I'm no longer a PHP developer (if I can help it) but I can't think of any other reason the global functions would still have inconsistent argument orders almost 14 years on. So, if the 'correctness' of their implementation bothers you, do what I did: move on. Because it will never get any better.
Incidentally, I wrote an anti-PHP rant last year called "Why PHP Won" that made its rounds here. It's pretty easy to get fed up with PHP, especially when you know there's better stuff out there. Once you're at that point though, you're done. It's anything-else time.
That said, in direct reference to your post: so what? My point still stands. I don't disagree with your assessment of the way it implements those features, I just don't think that it means "there is no hope for PHP", and I don't think it's at all productive to waste time complaining that it doesn't behave the way you want it to.
PHP -- and most other languages -- do have the power to "hack something together". You just have to be willing to adapt to the system at hand.
But there's a bit of a delta between this and the attention-grabbing title of the post.
It reminds me of a time when I had to maintain some very large programs written 100% in AWK - talk about a limited feature set - you had to work with a more limited set of functions and features, but often led to some creative solutions.
"PHP is as "complete" as it needs to be for us."
It's so complete that it's painful to write in? There's something to be said for languages that focus on a particular application while peripheral features suffer, but the PHP language is in no way superior to Python or Ruby, even in regards to web development, and there's no problem with saying so.
People use PHP because lots of other people know it, and because it's widely available. Those aren't merits of the language itself. Yes, good things can be written in PHP. That doesn't mean the language isn't demonstrably inferior.
Ummmm, wrong! The author isn't saying "PHP sucks because it doesn't have closures like my favorite language, so it's dead to me!". The author is saying "PHP claims to support closures, but when you actually attempt to use them for anything useful, they're broken."
So what he's actually cursing is that he has a round hole, and something that looks like a round peg, except it's really not.
PHP is a niche language, the niche is probably best described as "for want of something else that seems so easy to use and has such a low barrier to entry we are forced use it for web development".
The interesting thing here is that apparently the difference between PHP and the 'rest' of the languages out there is not large enough to supplant PHP in the WWW domain.
It's close enough to C that a whole generation of C programmers is intuitively at home in PHP, until they start using its advanced features.
But as long as you have to do simple stuff and get paid for that it almost always works. The few times that it doesn't you wished you never knew about the language though.
Just imagine, a language where the default 'scope' is global but globals are not available to functions and silently get replaced with empty variables. Who came up with that gem ?
The default scope is global, I did not say 'within a function'.
I know about the 'global' keyword, as does everybody else that has used PHP for more than 5 minutes.
If your language has a C like syntax and you have a default scope (which means that you can start executing code right from the first line without being in a function definition) then the default behaviour of a variable should be that it either does not exist inside a function (different scope) and throws an error or it should refer to the global variable.
To have a 'third option', which silently creates empty variables is very (no, make that extremely) poor design.
And no, I'm not telling how to break noprocrast :)
Very astute observation. PHP doesn't have to be the best. It just has to be good enough to maintain it's place.
PHP is trying really hard (it seems) to be a more advanced language, possibly to get new users to move over from other languages.
But they don't need to.
They should just stick to their roots, do what they do best:
Super small learning curve, low barrier to entry, it's everywhere, it works great for most apps, keep CRUD super-simple.
I think what a lot of the issues people have with PHP is not that it can't do something, but more that many of the ways you implement something feels like a "hack" - it works, but isn't as elegant as other languages.
On a side note: I'm tired of the "Pull a Calacanis" type of headlines like "x is dead", "x sucks" or "x is bullshit".
Please come up with something better.
$this cannot be used in lambdas or closures. So, when it comes to using these new features with objects, they're quite nearly completely useless.
... except "This is bullshit?" I mean, that's the censored version of what I think about this.
More interesting to me is the question: Why is PHP beating Python in this space? Some guesses:
* PHP webapps far easier to deploy.
* PHP docs give more usage examples, and also allow user comments.
"Use php, python, no, use ruby instead! Facebook uses PHP, YouTube Python, blah blah".
Kids, kids, behave! Scripting languages are for kids and web developers who don't know anything about programming and software engineering.
I've worked with Perl and Python developers for the last couple of years... they struggle to understand design patterns and don't even know what a domain object is.
I've worked with Perl and Python developers for the last couple of years... they struggle to understand design patterns and don't even know what a domain object is.
I've worked with Perl and Python developers for the last couple of years, they struggle to understand design patterns and don't even know what a domain object is.
I've worked with Perl and Python developers for the last couple of years... they struggle to understand design patterns and don't even know what a domain object is.
http://bugs.php.net/bug.php?id=47665
(Closed as "not a bug". Surprise!)