On Wed, Sep 29, 2010 at 2:56 PM, Stas Malyshev <[email protected]>wrote:
> Hi!
>
>
> public function __construct()
>> {
>> $this->a = new A();
>> $this->a();
>>
>
> Here you are calling method a() of object $this. Such method does not
> exist. No bug here. Methods are properties are different things.
Stas, thanks for this. Seems that w/ __invoke() in 5.3 if a method property
is_callable then the engine should check for that and call it. I realize
the problem now though, in php instance variables can have the same
identifier as instance methods therefore collisions could exist, for example
class B
{
function __invoke() {}
}
class A
{
public $c = null;
function c() {}
}
$a = new A();
$a->c = new B();
$a->c();
seems i got the notion this would work from javascript, however i also
realize the reason it works there, only a single identifier is allowed which
would map to either a scalar or a function object and in the later case
would be invokable.
the implementation in php make sense to me now.
thanks for your time,
-nathan