Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13800 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83445 invoked by uid 1010); 10 Nov 2004 01:00:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 83420 invoked from network); 10 Nov 2004 01:00:44 -0000 Received: from unknown (HELO moutng.kundenserver.de) (212.227.126.187) by pb1.pair.com with SMTP; 10 Nov 2004 01:00:44 -0000 Received: from [212.227.126.207] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 1CRgqq-0000iR-00 for internals@lists.php.net; Wed, 10 Nov 2004 02:00:44 +0100 Received: from [80.139.14.57] (helo=[80.139.14.57]) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 1CRgqq-0005HD-00 for internals@lists.php.net; Wed, 10 Nov 2004 02:00:44 +0100 To: internals@lists.php.net In-Reply-To: <15410470363.20041108111833@marcus-boerger.de> References: <1099844772.320.6.camel@localhost> <15410470363.20041108111833@marcus-boerger.de> Content-Type: text/plain Message-ID: <1100048113.311.15.camel@localhost> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Wed, 10 Nov 2004 01:55:13 +0100 Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de auth:e958292ea7b1c44e51b2b9ca0a9da460 Subject: Re: [PHP-DEV] __call interceptor and static methods From: thekid@thekid.de (Timm Friebe) 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