Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34963 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71527 invoked by uid 1010); 28 Jan 2008 15:18:55 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 71512 invoked from network); 28 Jan 2008 15:18:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jan 2008 15:18:55 -0000 Authentication-Results: pb1.pair.com header.from=rewbs.soal@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rewbs.soal@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.166.181 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rewbs.soal@gmail.com X-Host-Fingerprint: 64.233.166.181 py-out-1112.google.com Received: from [64.233.166.181] ([64.233.166.181:11412] helo=py-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B7/9B-26775-D52FD974 for ; Mon, 28 Jan 2008 10:18:53 -0500 Received: by py-out-1112.google.com with SMTP id u77so1904288pyb.16 for ; Mon, 28 Jan 2008 07:18:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=j8ecs2t51wiEnQAZ3IBIxEpJeA9CenjUZX4v9DU4ImA=; b=fHIVfGXhevhFXm/M3K88aJw1DajoJeCCWMnX3ZJd9aCdPpH2VudRvABqzDSQxGdeKi2rvWRYFGwPUisVJYP1Nzqk+eb03GQVNUjlj7NbgzSPiR5dIfErpmWnkIaUg4JFTQGZWIBbyYLyoGcEnM0QO3fVjdfMjiNH3Kb0q+UbI8M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=EC6iiz5iOS7o+1/zfbmSFxAkdBwwDT9t3Knms+eGLh1GD7ltKAon2URq42XmG9hGKWzPbR0oORGu+Wf0oYMEeoDcDDLkIVL/ItHlyBotcw9skrDlFXozpTUg0Avr5kNva9M5nl3Fc3bVH4RLXMEnipAPl/vyuhAmEwVTth1qXeQ= Received: by 10.65.150.18 with SMTP id c18mr11615948qbo.52.1201533530947; Mon, 28 Jan 2008 07:18:50 -0800 (PST) Received: by 10.65.250.2 with HTTP; Mon, 28 Jan 2008 07:18:50 -0800 (PST) Message-ID: <5a8807d10801280718p6d52f689s3a13c4d8c6521a3f@mail.gmail.com> Date: Mon, 28 Jan 2008 15:18:50 +0000 Reply-To: robin@soal.org To: "Marcus Boerger" , internals@lists.php.net In-Reply-To: <1109819085.20080128151237@marcus-boerger.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <5a8807d10801280520u7f8c7a9o8d2ab2efaa9c7644@mail.gmail.com> <1109819085.20080128151237@marcus-boerger.de> Subject: Re: [PHP-DEV] Protected static props redeclared as public share value across classes From: rewbs.soal@gmail.com ("Robin Fernandes") Hi Marcus, Thanks for the prompt reply and explanation. I have some further questions though: > If the base class had the property defined as private > then the property is private to that specific class and not directly > accessible by derived classes that is it's name gets prefixed with the class > name.. So in: > class A { private static $p; } class B extends A { private static $p; } > we have two different properties: Understood. But if we have two separate properties for the reason that A::$p is not visible to B, then how about these cases? class A { protected static $p; } class B extends A { protected static $p; } class A { public static $p; } class B extends A { public static $p; } In both of those cases, A::$p is visible to the derived class, but the re-declaration results in A::$p and B::$p being two separate properties (see pastebin.com/fca2cd5b and pastebin.com/f4f94b32d for a demonstration). This is one of the reasons I find the case where we end up with only one property value to be surprising. Another reason is that, as illustrated in my previous post, PHP's behaviour doesn't seem to correlate with the inheritance rules of other languages I'm familiar with: you always end up with two distinct static properties in Java, C++ and C# (though of course I understand this fact on its own is does not mean PHP is wrong :). Lastly, with overridden static methods, PHP always yields two distinct methods, regardless of the visibility modifiers. See http://pastebin.com/f27f009c4 . Granted, with methods any other behaviour would be very odd indeed, but it does emphasize an inconsistency between method and property inheritance rules in PHP. So for now I continue to feel this is a little strange. Any further explanations would be greatly appreciated. :) Thanks, Robin > Best regards, > Marcus