Jochem Maas wrote:
> Stanislav Malyshev wrote:
>
>>> Rest assured that this is not the bad kind of 'more complex' I believe
>>>
>> I'm afraid I must disagree. The feature that was missing was to know the
>> true calling class name. That was implemented. You can build from it,
>> there's no need to add further complication to the language. You can
>> easily find out the calling class for static call, you can easily find
>> it's parent, provided one exists, you can easily call any method of this
>> class.
>>
>
> class A {
> static function find($id) {
> // lets try and find a 'something'
> }
> }
>
> class B extends A {}
>
> // I'd like a 'B' please bob.
> $b = B::find( 1 );
>
>
>
> are you saying that A::find() can tell that it was called as B::find() ?
>
No, your example would work. WHere it breaks down is if you want to
specialize B::find();
class B extends A {
static function find($id) {
/* do something special */
parent::find($id);
}
}
in that situation A::find(); would not be able to know it was being
called by B::find() because parent:: is considered an explicit class
name reference.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php