Does anyone who knows and uses Ruby or Python and PHP have any thoughts on whether its worth me revisiting PHP? (I currently use Ruby exclusively, after I left PHP when I was pretty much a total amateur.)
It does look cool with all these new features, I'm just not sure if it'd be a slight waste of my time, since I already know a language which works well for the web…?
Up until a few months ago I was entrenched in PHP. Now I don't do any PHP, and nothing in 5.3 makes it enticing to go back. They've fixed some things (late static binding), added some things (lambda's, namespaces), but these are already things that Ruby has and was designed for.
If you are creating a product that will be installed by your customers on their own web hosting accounts, PHP is a no brainer due to it's large install base, and you'll want to be sure your product works with PHP 5.3. If you are simply picking a language for your own internal use, go with what you like and know.
The article incorrectly states that Traits (think mix-ins, for you ruby guys) have been added to 5.3. This isn't true. While a patch has been implemented, it isn't slated to be released in 5.3. Some later version, no doubt.
Sometimes I think time has come for somebody to fork php, fix all the little quirks and relaunch it as a new language, simpler and more adapted to the web world of today.
Blog\save() is one of them
Using the dot as concatenator is another one.
And there are hundreds that haven´t been touched because of fear of backward compatibility uprising.
I can live with a lot of the crap. I understand the history and practicality of it. But the backslash for namespaces. That's just too much. There's no history for it. There's no good reason for it. It's just stupid and ugly. If someone forked PHP tomorrow and changed just that one thing for now I'd probably use the fork. The decision shows that PHP will not get better.
I think most people have internalised the notion of backslash being the escape operator. That's the way it's used in a lot of languages. Using it for something different not only feels dirty, it may also make it harder to get the "feel" (i.e. to quickly recognize and use) of the namespace operator.
Maybe that concern is invalid and we'll quickly adjust. Since this is what the PHP folks have decided, we'll soon get the chance to find out.
In PHP the backslash is also an escape operator, but only when used within the confines of a string. In this case, you're not within a string, so it shouldn't be confusing. But like you said, we'll soon get the chance to find out.
Allow me to clarify. I don't mean that it's confusing or ambiguous. What I mean is that the only place people have seen the backslash in their language and many other places is as an escape operator. This means that the backslash - when seen alone - was most likely to be an escape character.
When scanning code, you often use "landmarks" to find your way about. This is why indentation is so useful. But this is also used on a smaller level. When seeing a comma, you usually expect to find something else after it, just because that's what you're used to.
The same can hold for backslashes. Personally, I "feel" that backslashes are an escape character to such a degree that to see one without an escaped item after it, feels like a syntax error.
Now, I'm not arguing that this is a terrible choice of the PHP folks - at least we finally get namespaces - but I do understand how some people find the backspace an irritating choice.
Because the language already has :: copied from C++. But rather than continuing to use :: for both namespaces and static class access, exactly like it's done in C++, they added yet another operator. To solve a problem that doesn't exist.
So rather than simplifying the language, they're making it more complicated (especially by choosing the escape character). It's just dumb.
Well, to be fair to the implementors, using \ makes the parser slightly easier to implement. Good languages (and libraries) are willing to make implementation harder if it makes the code easier for the user to write. But this is PHP.
I wish someone would write a PHP parser with a Ruby-like syntax. Obviously the more powerful features of Ruby would still be missing, but just having a more readable syntax would be a nice improvement.
If you put it that way, then I would have to agree. But I don't think I would go so far as to fork the language to correct the issue as was suggested above.
Nobody uses PHP because it is beautiful... Creating your own version would make you loose the one true benefit of PHP: easy deployment using many available hosting services.
Unless, of course, you manage to make it popular as the original (just remember to maintain backward compatibility with thousands of libraries!)
It works, but is more difficult to debug and, of course, to integrate with existing libraries.
I don't think many have taken this path - GWT has not exactly taken the developer community by storm. Even minimal approaches (e.g. QT extending C++ syntax to deal with signals and slots) is considered unacceptable by many.
Not a bad idea.. you could write in your lang of choice, presumably Ruby or Python, Scheme/lisp with a syntax / DSL you like.. then generate obfuscated/compressed PHP to run on the many cheap LAMP hosting platforms :]
It does look cool with all these new features, I'm just not sure if it'd be a slight waste of my time, since I already know a language which works well for the web…?