On Mon, 2004-11-08 at 11:18, Marcus Boerger wrote:
> Hello Timm,
> 
>   you won't be able to tell from inside __call() whether a static or
> non static method was meant.

isset($this) does work fine.

> The same holds for __get() and __set().
> Also if we start using such code we'd need a class constructor.

Why?

> Thus this dicussion is leading to the following set of new magics:
[...]

Instead of this: How about an extra (third) parameter $context to
__call() which holds either object $this or string $classname.

The signature would then be:
  mixed __call(string $name, array $args [, mixed $context]);

Checking whether __call() was statically invoked could either be
performed via code such as:

  is_object($context) 
    ? 'in context of '.get_class($context) 
    : 'statically in class '.$context

On Mon, 2004-11-08 at 00:26, Andi Gutmans wrote: 
> In most cases method overloading is used for objects and not for classes 
> (for example, initiating a SOAP object and then calling methods on it.).
> It doesn't make sense to mix these two things because it would lead to 
> confusion what context the method was called in. You would either need 
> another call back or pass a flag to __call() and in my opinion just doesn't 
> seem to be worth it.

I think an extra flag wouldn't really hurt. No BC issue btw (mentioned in 
another mail), extra parameters are always ignored. Just like the 
set_error_handler() callback which you can add the array $context 
parameter to.

- Timm

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

Reply via email to