Hello Stanislav,

Wednesday, July 23, 2008, 12:54:48 AM, you wrote:

> 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.

Hmmmm, the amount of problems is pretty long. So even though it might sound
cool to do it. It is the better deceision to not allow it. Also you've
shown several paths where it would slow general execution down. Yet I hate
not being able to easily make it work.

Best regards,
 Marcus


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to