Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30034 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33363 invoked by uid 1010); 1 Jun 2007 22:57:03 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 33347 invoked from network); 1 Jun 2007 22:57:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Jun 2007 22:57:03 -0000 X-Host-Fingerprint: 194.109.253.196 mediawave.xs4all.nl Received: from [194.109.253.196] ([194.109.253.196:25589] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/E5-17036-D34A0664 for ; Fri, 01 Jun 2007 18:57:02 -0400 To: internals@lists.php.net,Ken Stanley Message-ID: <4660A44F.6060802@mediawave.nl> Date: Sat, 02 Jun 2007 00:57:19 +0200 User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 References: <56275.216.230.84.67.1180484964.squirrel@www.l-i-e.com> <465D9040.6030001@iamjochem.com> <43689.216.230.84.67.1180643866.squirrel@www.l-i-e.com> <465FC76B.6030208@mediawave.nl> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 194.109.253.196 Subject: Re: [PHP-DEV] late static binding From: bart@mediawave.nl (Bart de Boer) Ken Stanley wrote: > As for parent/self:: and even static::, what makes > them static is the scope resolution operator (::), not their name. > Their name just implies the context in which they are to be used. > That's right. And that's exactly why it's such a bad idea to call it static::. It's the scope resolution operator which already makes them static, not their name. (I'm sorry for catching you on your words ;) ) >> Perhaps we should forget about the whole keyword and just allow objects >> to access its static members like any other member? It works like that >> for static functions too. Why not let it act that way for static >> variables?: > > I would have to disagree with you on this subject. The whole point of > having > a static model is the ability to access members of classes without > having to > instantiate them. > That's not right. Accessing the child class would only be possible from within an instantiated object. Unlike parent::, you will never be able to use static:: in a purely static context. Imagine there are multiple child classes which all inherit from the same base class. If there's no instance, PHP won't be able to know which child class to target with child::, static:: or whateverkeyword:: since it can be any one of those child classes. > ClassName::classMember is completely different than > $className->classMember. Using the former means that you do not necessarily > have an instantiated object of ClassName, but in the latter it is implied > that you do. I would think that using $this::classMember in the wrong place > could lead to some very troubling errors at run-time. > Since there's no use for it in a static context anyway, I think static::, child:: or whateverkeyword:: would be confusing for developers. Since this would only work from withing an instance, I thought it might be a better idea to make static members accessible through $this->. (I think I even expected this to work when I first found out it didn't ;) )