Re: closures questions
| From: | Marcus Boerger | Date: | Tue, 22 Jul 2008 22:44:40 +0000 |
| Subject: | Re: closures questions | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39204@lists.php.net to get a copy of this message | ||
Hello Stanislav,
Tuesday, July 22, 2008, 11:07:58 PM, you wrote:
> Hi!
>> Can't we change zend_std_get_method() to return a zend_internal_function
>> struct in case of a closure on a property? The only thing that needs to
> That means that:
> 1. We can't have properties named same as functions anymore
Nope. It means if you have a function named foo and a property foo that
sores a closure and then call foo(), then obviously the function is called
rather than the closure.
> 2. We'd have to check properties every time method name was not found
We could add a flag for this to make it faster. That is whenever someone
sets a property to a closure.
> 3. __call will be broken - now should we check properties or go to
> __call when method is not defined?
How is it broken? __call does not get called if there is something callable
already.
> 4. zend_std_get_method should be calling __get too, in case this
> property is not a direct property!
Maybe. However this only applies to overloaded objects. Maybe those cannot
or should not hold closures.
> I don't think it's going to work out. Using __invoke is much easier.
> --
> Stanislav Malyshev, Zend Software Architect
> stas@zend.com http://www.zend.com/
> (408)253-8829 MSN: stas@zend.com
Best regards,
Marcus