Re: Idea: ifdef-like feature to ease userland BC
On Sun, Mar 9, 2014 at 9:09 AM, Lester Caine <[email protected]> wrote:
> Rouven Weßling wrote:
>
>> I really don't want to come across as hostile, but this seems poorly
>> thought out. We all like to play with the new shiny, but I don't see such a
>> feature benefitting the quality of the code out there.
>>
>
> I don't mind coming across 'hostile' ...
> The idea that we need to add additional hacks to get around the fact that
> some 'shiny new features' simply don't sit well in the vast majority of
> legacy code. If there is an existing codebase designed for a previous
> version of PHP, simply hacking in bits that might improve things for some
> later users is just wrong full stop! To get the best out of many new
> features the code needs to be redesigned properly!
>
> If one is designing to support older versions then one simply does not use
> the new features. e_strict requires enough structural changes that
> something like this would not work anyway, so there will be many places
> where even this hack will stop legacy versions of PHP running the code?
I'm not in favour of such thing.
- It adds very complex preprocessor code, making the overall PHP code hard
to read and understand. Leave preprocessor to C.
- OPCache already does many things to try to improve the generated code at
compilation, so that execution OPCodes are optimized depending on the
environment. There still has many ways to improve things in here though.
- The more we add features to support multiple PHP version, the more slow
people will migrate. You want to absolutely use "yield" and pretty nice new
syntax feature of PHP ? Simply drop your support for older PHP versions.
That's what well-known-frameworks did with 5.3 (mainly to benefit from
anonymous functions and namespaces), and that's what they'll have to do for
next PHP versions.
Julien.P
Thread (13 messages)