Re: Inconsistencies in callable, call_user_func and direct variable calls

From: Date: Thu, 19 Mar 2015 23:00:16 +0000
Subject: Re: Inconsistencies in callable, call_user_func and direct variable calls
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to internals+get-85248@lists.php.net to get a copy of this message
On 19/03/2015 22:43, Yasuo Ohgaki wrote:
Hi Rowan, On Fri, Mar 20, 2015 at 7:12 AM, Rowan Collins <rowan.collins@gmail.com <mailto:rowan.collins@gmail.com>> wrote:
    On 19/03/2015 20:50, Yasuo Ohgaki wrote:
        Hi Sebastian,
        On Thu, Mar 19, 2015 at 9:48 PM, Sebastian B.-Hagensen
        <sbj.ml.read@gmail.com <mailto:sbj.ml.read@gmail.com>
        <mailto:sbj.ml.read@gmail.com <mailto:sbj.ml.read@gmail.com>>>
        wrote:
            2015-03-19 12:51 GMT+01:00 Yasuo Ohgaki
        <yohgaki@ohgaki.net <mailto:yohgaki@ohgaki.net>
            <mailto:yohgaki@ohgaki.net <mailto:yohgaki@ohgaki.net>>>:
Distinguishing array and callable is problematic. Array callable is better to be deprecated in the long
        run. IMHO.
            Then how would you write an callback containing an already
            constructed object?
            $a = [$object, 'method'];
            The alternative is unnecessarily cumbersome:
            $a = function($methodArg1, $methodArg2) use($object) { return
            $object->method($methodArg1, $methodArg2); };
        I'm not proposing deprecate it soon, but in the long run.
        It will need a decade to deprecate it.
    It is not time that is needed, but an alternative way of
    expressing "use this instance method as a callback", such as those
    discussed elsewhere in the thread.
I replied how it could be deprecated. I'm not commenting for it, but the deprecation discussion. You cannot restrict discussion to what you would want, can it?
I had no intention of restricting the discussion in any way, apologies if it came across that way. Perhaps what I should have said is it is not *only* time that is needed - we need to design the replacement before it's worth even thinking about deprecating something. Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#85248) next »