Do you know how long it took to finally get rid of PHP 4? Do you know how long web hosters (and with that most open source projects targeting a wide audience) were sticking with PHP4? Even now that there won't be any more php4 releases, there are STILL projects targeting PHP4. There are STILL webhosts only providing support for PHP4. More than 5 years after PHP5 came out
All this even though most PHP4 scripts run unaltered in php5.
And now you suggest to drop backwards compatibiliy to get rid of warts? How long do you think it would take before that new language will get any significant deployment? What good will all the new features be if you are not able to use them in the next 10+ years?
Personally, I like to see them add features in a backwards compatible way. Knowing PHP and programming in general, I can stay away of the bad parts but still use all the new features in the foreseeable (2-3 years) future.
Just have a look at python3 of you want a taste if what you were just suggesting.
> Even now that there won't be any more php4 releases, there are STILL projects targeting PHP4. There are STILL webhosts only providing support for PHP4. More than 5 years after PHP5 came out
The fact that PHP broke many websites when going from PHP3 to PHP4, then at each PHP4 minor release is probably largely responsible for this conservatism.
I agree with you that incompatible changes by removing bad parts is definitely painful, but it makes PHP more sustainable in long term.
This can happen in a more feasible way, e.g. freeze PHP5 (unlike the current situation), don't add any new stuffs; branch out a subset of PHP (removing bad parts), and continue the development there.
Not sure of what kind of legacy features you would want to be removed but it's not like they are just building on top without thinking.
PHP 5.4 will also drop:
- safe mode
- register_globals
- allow_call_time_pass_reference/y2k_compliance and other legacy ini stuff
- "continue 123" syntax (can be replaced with goto). As far as I recall this is done since it's barely used and if removed would allow to implement some opcode performance optimizations.
Dropping some PHP 4 era syntax is obviously out of question due to already mentioned webhosting and backwards compatibility issues.
Depreciating things is moving in the right direction, throwing a depreciated warning in the code. Slow but good way to change developer behaviors towards better PHP code. http://php.net/manual/en/migration53.deprecated.php
A few of PHP's most (publicly) hated components are being removed in 5.4 (which may become 6, from what I can tell this article is lying when it says 5.4 is "around the corner") - register_globals, magic_quotes is being discussed. Even the old asp_tags setting is going. However these have no relevance to me as I haven't used them in years.
If they are going that far, it would probably be better to get rid of more in one go, rather than giving people legacy code headaches with each release.
I guess I would focus on cleanup, method names and parameter orders. I don't know enough about the internals to know if also allowing say $var = $val->substring(0, 2); could be an alias to how values are currently passed into functions.
At least they didn't implement them by trying to come up with every possible mixin you'd ever want to write and then define them in the global namespace. Progress?
Honestly, I would prefer PHP remove all the bad parts of PHP before adding new things.
This has already been done, and the result is called "Python" (or Ruby, or ...). SCNR.
Edit: ok, I realize this was maybe a bit too snarky. But I mean it: if you remove all the somewhat strange parts from PHP, you are breaking backwards compatibility. And at that point, your users have no reason not to move to another, maybe cleaner language (e.g. Python) all together.
So if you want to get a cleaner PHP while breaking backwards compatibility, you might as well just use a different language.
All this even though most PHP4 scripts run unaltered in php5.
And now you suggest to drop backwards compatibiliy to get rid of warts? How long do you think it would take before that new language will get any significant deployment? What good will all the new features be if you are not able to use them in the next 10+ years?
Personally, I like to see them add features in a backwards compatible way. Knowing PHP and programming in general, I can stay away of the bad parts but still use all the new features in the foreseeable (2-3 years) future.
Just have a look at python3 of you want a taste if what you were just suggesting.