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 con
MB>>Adding an argument would be a major BC but sure is_null($this) would work,
MB>>only it would be another big slowdown.
I don't think 2-3 additional opcodes are a "big" slowdown - if you are
using non-default ctors and accessors anyway, you probably are doing
something order of magnitude bigge
Hello Stanislav,
Monday, November 8, 2004, 11:29:13 AM, you wrote:
MB>>> you won't be able to tell from inside __call() whether a static or
MB>>> non static method was meant.
> Technically, it's not a big problem IMO - there could be an argument added
> or some other solution, like presence of $
MB>> you won't be able to tell from inside __call() whether a static or
MB>> non static method was meant.
Technically, it's not a big problem IMO - there could be an argument added
or some other solution, like presence of $this.
MB>>non static method was meant. The same holds for __get() and __
Hello Timm,
you won't be able to tell from inside __call() whether a static or
non static method was meant. The same holds for __get() and __set().
Also if we start using such code we'd need a class constructor. Thus
this dicussion is leading to the following set of new magics:
__static_get
__s
would it be doable (and more acceptable / less confusing)
if __call could only be invoked statically if the class
was abstract and vice versa only be invoked on objects
if the class was not abstract? (the idea being to make the distinction
during parsing rather than execution, allowing you to throw
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
Timm Friebe wrote:
> is there any reason why __call shouldn't be invoked for static method
> calls?
None that I can think of. If it is doable it should be supported.
--
Sebastian Bergmann http://www.sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5
Hi,
is there any reason why __call shouldn't be invoked for static method
calls?
Reproduce
-
php5 -r 'class A { function __call($name, $args) { var_dump($name,
$args); } } A::foo();'
Actual result
-
Fatal error: Call to undefined method A::foo() in Command line code on
line 1