On 02/01/2014 20:00, Florin Patan wrote:
I suppose it wouldn't be a problem with having a tool that can
generate an AST out of a .php file and dump it back to a newer syntax
(as long as only the function / method / classes name and parameter
order is changing).
Don't forget that there are various ways to do what could loosely be described as "reflection" or "meta-programming" in PHP - e.g. given call_user_func_array($func, $args) we may need to correct the name stored in the string $func, or the order of items in the array $args.
These are very hard to even detect with an automated tool, let alone fix - indeed, I doubt it is even theoretically possible in many cases. That leaves you with either code that needs painstaking manual upgrades, or a runtime compatibility mode.
Both of these come with a cost to the community at large - many people want to distribute (or internally manage) code that is both backwards and forwards compatible, i.e. runs on as many past and future versions of the platform as possible. That's impossible to do with a hard compatibility break, and tricky if the compatibility breaks are subtle (such as new function names/aliases) as you have to keep testing and removing the new names until you no longer need to support the old versions.
A more fundamental restructuring (e.g. an OO implementation of "basic" operations) could more happily sit alongside the existing functionality, with code very obviously using either one style or the other, and compatibility easy to maintain over the longer term.
Regards,
--
Rowan Collins
[IMSoP]