Re: closures questions

From: Date: Tue, 22 Jul 2008 22:54:48 +0000
Subject: Re: closures questions
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-39205@lists.php.net to get a copy of this message
Hi!
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.
That means you can't call the closure, and nothing alerts you of the problem.
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.
Whenever someone sets a property to a closure what happens? Does it mean that every call to write_property argument would be checked for instanceof Closure? What about write_dimension or get_property_ptr_ptr?
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.
__call doesn't work anymore if there's a property with the name that is equal to called function. That could be a big surprise for classes that use __call for routing.
Maybe. However this only applies to overloaded objects. Maybe those cannot or should not hold closures.
What do you mean by "overloaded objects"? Every object has get_property handler. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#39205) next »