Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7959 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77462 invoked by uid 1010); 18 Feb 2004 17:14:10 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 77361 invoked from network); 18 Feb 2004 17:14:10 -0000 Received: from unknown (HELO sccrmhc11.comcast.net) (204.127.202.55) by pb1.pair.com with SMTP; 18 Feb 2004 17:14:10 -0000 Received: from coogle.localdomain (pcp02905316pcs.roylok01.mi.comcast.net[68.62.1.1]) by comcast.net (sccrmhc11) with SMTP id <2004021817140901100rrkjje>; Wed, 18 Feb 2004 17:14:09 +0000 To: Pierre-Alain Joye Cc: PHP Internals In-Reply-To: <20040218115421.434ac336@localhost.localdomain> References: <1077090830.30573.1.camel@coogle.localdomain> <20040218115421.434ac336@localhost.localdomain> Content-Type: text/plain Message-ID: <1077124444.30567.27.camel@coogle.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Wed, 18 Feb 2004 12:14:04 -0500 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Static weirdness.. From: john@coggeshall.org (John Coggeshall) > imho, this is the expected behavior. At least a notice should be raised. > I do not see a reason to define $this if a method is explicitly defined > as static (means it should not be called dynamically). Declare the > same funciton as public|private|protected and everything works fine. There is no reason I can possibly imagine why methods declared as static should be allowed to be called from a non-static context. Sure, in my own classes I know not to call a method I declared as static from an instance. But IMO the whole point of static is to create a restriction in then engine keeping from anyone calling that function in anything other than a static context. class foo { static function bar() { echo "Hello.\n"; } function foobar(); } $a = new foo; $b->bar(); This is a completely acceptable thing, and it is IMO completely wrong to even allow in the engine. foo::bar() should be the only accepted syntax for static functions. If I download a new class from some site, or otherwise use someone else's code, how do I know other than digging through the source on a method's context? If $this isn't set I can't do the check, and if then engine doesn't do it there isn't a way to tell the difference. -- -=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=- John Coggeshall http://www.coggeshall.org/ The PHP Developer's Handbook http://www.php-handbook.com/ -=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=-