On Thu, Oct 17, 2013 at 2:22 PM, Rowan Collins <[email protected]> wrote:
> On 17/10/2013 20:29, Pierre Joye wrote:
>>
>> On Thu, Oct 17, 2013 at 11:24 AM, Rowan Collins <[email protected]>
>> wrote:
>>>
>>> If create_function did not exist, would any of those use cases persuade
>>> you that it should?
>>
>> Not with latest PHP releases, but that's the point: we try to keep BC.
>
>
> Well, to an extent - it is not true that any PHP script which works in PHP
> 5.2 will work in PHP 5.5, let alone work identically. For instance,
> call-time pass-by-reference causes a fatal error in PHP >= 5.4; unlike calls
> to create_function, it's tricky to search for code that used that, and to be
> confident of the implications of changing it.
Comparing a widely used feature, working well with something that
never really worked (and why we have removed it) is hardly a good
argument to remove create_function :-)
> So it is not a case of "thou shalt not break BC", but a case of "how big a
> BC break is this?" Obviously, there are other questions (e.g. challenging
> the reasons *for* removing it), but I'd like to break this one apart a bit:
It is, create_function works and is widely used. We can provide
good/better documentation to inform our users about better, cleaner,
sexier ways to achieve the same but deprecating it in a 5.x release is
not going to work out well.
> Q: Is it difficult to upgrade code to not use the feature?
> A: For 95%+ of cases, my contention is that refactoring use of
> create_function() to use closures is pretty trivial. A few cases which
> explicitly used its quirks may need a wrapper around eval() etc. Nobody has
> yet piped up with a use case which would rely on the harder-to-emulate
> aspects of the current implementation.
Code should not be updated in the 1st place unless there is a really
critical issue, something we absolutely have to change. That's not the
case here, we do not enforce good practices (or we could enforce so
many other things in the language ;).
Also I think we disagree on that, we discussed pretty much all points,
let face it :). I have to suggest to create a RFC if you feel like it
has to be deprecated and see what other developers want.
Cheers,
--
Pierre
@pierrejoye | http://www.libgd.org