Hi Etienne, Am Samstag, den 02.08.2008, 19:36 +0200 schrieb Etienne Kneuss: [...] > 1) I don't believe that having it thrown as another of those magic > method is a good idea. Rather, I'd like to have it represented by an > interface: Invokable. That way, type hints/checks can be done in user > land in a sane matter:
I would like that too, but if we do so, we must pass the parameters as an array. With an interface we lose flexibility and that's why I would not do it. > 2) Do we really want __invoke's argument to be mapped to caller > arguments. Providing an array of arguments, ala __call(Static) sounds > more consistent. > class A { public function __invoke($arg) {var_dump($arg); }} $a = new > A; $a(1,2); // int(1), currently. IMHO it should be array(1,2) That's what I don't like and this is really a dependency for 1). > 3) Do we really want to allow both static and non-static versions of __invoke > ? > class A { public static function __invoke($args) { .. }} $a = new A; > $a(); being a static call to __invoke doesn't make much sense to me. Doesn't make any sense yes indeed. If we would have __invokeStatic() it would be another story. cu, Lars
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil