Re: Inconsistencies in callable, call_user_func and direct variable calls

From: Date: Thu, 19 Mar 2015 22:57:40 +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 13 14 15  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Am 19.03.2015 um 22:11 schrieb Levi Morrison:
> On Thu, Mar 19, 2015 at 1:44 PM, Dennis Birkholz <[email protected]> wrote:
>> Hi,
>>
>> Am 19.03.2015 um 20:26 schrieb Levi Morrison:
>>> On Thu, Mar 19, 2015 at 1:05 PM, Dennis Birkholz <[email protected]> wrote:
>>>> Hi,
>>>>
>>>> Am 19.03.2015 um 17:27 schrieb Sebastian B.-Hagensen:
>>>>> Another way to unify array and string callback may be to use the
>>>>> callable syntax and have it return a closure:
>>>>> callable('strlen');
>>>>> callable($object, $methodName);
>>>>> callable('class', 'staticMethod')
>>>>
>>>> but before that happens, we should make closures serializable.
>>> What does closures being serializable have to do with this feature?
>>
>> If you replace the array($object, 'method') syntax by callable($object,
>> 'method') which returns a closure, you can not serialize callables any
>> more which is currently possible. Before we replace working language
>> features by closures we should update closures to be usable in all
>> required situations.
> 
> Many callable are inherently not serializable. This is not solvable in
> the general case.
> 
> Why are you serializing array($object, "method") callable currently?
> (As in, what is the use case?)

passing callbacks to a worker process, storing an object structure with
a their of event handlers, etc.


Thread (32 messages)

« previous php.internals (#85247) next »