Short version:
Fix old bugs, don't add new ones.
Long version:
I'm a bit surprised by the amount of new language constructs recently requested on the internals list.
First of all, I should note that none of these requests are supported by patches, so I call them
gimme's. "
Gimme that feature from language X, I used it once and it's just awesome!!!1111", you know. Quite useless.
Second, people seem to forget the fact that new features do not appear in older versions automagically after they're added into HEAD and old installations tend to live
forever very long. So even
if this feature does eventually get into the core, for quite a long time you would be able to use it only on your own server because your hosting provider uses good old PHP 4.3.4 (or even PHP3, see
this) and is not going to update it because this may break other customers phpBB's.
So here is the new "feature" I would like propose myself: let's make all the existing things working as they should instead of adding a bunch of new features used by a couple of hackers.
If you're bored and have an itch to hack something, take a look at
bugs.php.net, I'm sure you'll find it quite entertaining.
The more features that keep getting added, the more bugs in 5.x and the longer we wait until 6. It would be cool if there was a bit more control on how things were added so the minor version releases were closer to bug fixes and major versions were released once a year with new major features added. It would also make adopting newer versions of PHP easier as there would be less change between versions. Well, in theory anyway...
I believe you know how to subscribe to internals & cvs log, so you can do it anytime =)
>It would also make adopting newer versions of PHP easier as there would be less change
>between versions.
That's easy to do, too.
Just test release candidates by running your own scripts, this way you can catch all the problems that may affect you before they bite you for real.
1. Better syntax for anonymous functions/classes, similar to what Java or .NET or JavaScript have.
array_map(function ($i) {
// do something
}, $array);
or
array_map(new ICallback() {
function callback($i) {
// do something
}
}, $array);
and
2. OOP interface for main language types: arrays, strings, numbers.
Oh, yeah.. OO interface to numbers is definitely #1 in the list of most useless things that have ever been proposed.
Sorry, but you interpret a remark too literally. JavaScript/Ruby has OOP access to number's method and thousands of developers use it.
Am I the only one who prefers
$array.map($callback1).reduce($callback2)
or
$string.substr(2).upper();
instead of
arra_reduce(array_map($array, $callback1), $callback2);
and
strtoupper(substr($string, 2))
???
>$array.map($callback1).reduce($callback2)
I'm afraid, yes.
Thank you, Antony.
And although I agree overall, still if there is ever a time to discuss new features it's now because major release points (5.3, 6.0) are coming... so feel more free to write posts like this after 5.3.0 RC is released
Some of them may EVEN have implemented intelligent features... that PHP has not... yet.
The PHP internal crew, and Antony Dogval in particular, are not the only Albert Einsteins known in computer science.
I believe PHP should not support all the intelligent features existing in other languages just because they are so good.
It's better to have a limited set of features and make them work good.
Now tell me please when did I say that people developing other languages are stupid (and I'm Albert Einstein)?
Heh. All you're saying is "feature creep is bad when there are all these bugs to be fixed".
Anthony I do hope you realize you're coming off as anti-progress in our beloved php. Your idea of progress obviously can differ from my own/others, but this viewpoint of yours is too wide. It shuts out all ideas for advances in php as a language (even ones that come with a patch to HEAD) and leaves php stagnant (or you might say "still", ie stable).
There are an inordinate number of "bugs" reported on bugs.php.net every day that are not bugs at all, just somebody doing something stupid with the language. (Case in point, first bug today: http://bugs.php.net/bug.php?id=43642). I wonder if the level of stupidity would go down a little if these people used another language with more of the "intelligent features" mentioned prior. While there is no doubt that shitty programmers exist in all languages, and that a language cannot make a programmer better per say, built-in language features like OOP access or anonymous functions/blocks/procs/lamdas/whatever-you-call-it-in-your-language can certainly encourage coding paradigms that more than not can lead to better code.
PHP has the distinction among all languages that it is built from scratch for the web. It also has the distinction of being highly revolted amongst languages in use on the web today by those with experience in other languages with intelligent features (for context try http://programming.reddit.com/info/62shw/comments/c02ngji), I would say even more revolted that perl with it's awful syntax. But people still use it because it presents zero barriers to anything fundamental to web programming.
php borrowed from C. It borrowed from Java. Lets not throw out the possibility that it can borrow intelligent features from other languages yet.
That's not true, not all ideas require changes to the language syntax.
Changing its syntax and adding new language constructs is definitely not required to make it better.
>There are an inordinate number of "bugs" reported on bugs.php.net every day
>that are not bugs at all, just somebody doing something stupid with the language.
I know that very well, thank you.
>Lets not throw out the possibility that it can borrow intelligent features from other languages yet.
Again, that does not mean ALL the features have to be implemented just because they're so cool.
New additions/changes should be carefully weighted and implemented only if they are really required.
Surely every person proposing a new feature believes his feature is the most needed & the most intelligent one, but let me remind you one thing: people come and people go, but developers have to do the dirty job which nobody wants to do - support all the features in the language.
So every feature, even if it's used by 10 people in the world, results in more headache for developers (and we have quite limited number of those).
As a bottom line - yes, basically my position in most cases looks like this (assuming that the feature is really intelligent):
"Are you going to support the feature you're proposing? Yes? I'm ok with it. No, you want me to do it? Well, I'm against it."
PHP4 and PHP5 have been real changes, for the reasons you know. Those two versions allowed developers to build larger and larger web applications. But PHP6...
PHP has not improved by itself. I'm not even sure it has learnt from abstract works, or from the programming language theory : most elements in PHP come from other languages : C of course, Perl, Java.
When the object oriented features of PHP were discussed, what was invoked ? Java.
Not UML, unfortunately (unfortunately, because UML helps to understand what in Java is typical of Java, and what is typical of the theory of objects).
PHP has improved because the internal developers have improved their skills, and have learnt from other languages.
See what the developers posted on Internal list in 1999, and what they post today. All those people who are so proud and respected today, like Stan, or yourself, or Andy... those people who have a contemptuous look on what the young geeks do, all of you have learnt, year after year, like everybody.
Java and C were not rivals. ASP was a joke. But with Python or Ruby, it's just like PHP has got suddenly paralysed.
Looking to what the others are doing ? My God ! Out of question !
We are adults now ! Knowledged ! Qualifed ! We are self-sufficient, we are independant ! We don't need advise !
And the result : PHP6.
Unicode support. Ok, nice.
Yet, there'd be so many things to do. Just with objects and classes. Just with that, I don't even mention the rest.
See what Marcus Boerger has done with SPL. This is extremely intelligent.
Ok, you're right when you say there are enough bugs to fix with the actual PHP.
But I don't like the tone on the internal list today, and the way the "leaders" receive each new proposal.
"- That ? What for ?"
Ok, all suggestions are not good, of course.
But I'm slightly estonished by that sudden immobility, while the web development keeps flourishing everywhere.
Now, it can be that significant part of them may need feature X - but in many cases, they just don't. It is fun to play with fancy CS concepts, but great many people are perfectly good without them, and many of the rest would be better off using other more specialized languages anyway. If you have a sewing machine and you want to improve it, you make it to sew better, not to brew coffee and play chess. Sometimes less is better.
There are an inordinate number of "bugs" reported on bugs.php.net every day that are not bugs at all, just somebody doing something stupid with the language. (Case in point: http://bugs.php.net/bug.php?id=43642). I wonder if the level of stupidity would go down a little if these people used another language with more of the "intelligent features" mentioned prior. While there is no doubt that shitty programmers exist in all languages, and that a language cannot make a programmer better per say, built-in language features like OOP access or anonymous functions/blocks/procs/lamdas/whatever-you-call-it-in-language-XXX certainly encourage coding paradigms that can more than not lead to better code.