roxen.lists.pike.general

Subject Author Date
Re: [7.8.316] more Problems with Parser.XML.DOM (w/patch) Reinhard Pfau <Reinhard[dot]Pfau[at]gmx[dot]de> 14-08-2009
On Thu, 2009-08-13 at 23:10 +0200, Martin Bähr wrote:
> On Thu, Aug 13, 2009 at 10:21:51PM +0200, Reinhard Pfau wrote:
> > Looking closer at these methods it looks like that the modifier
> > "protected" was meant to work like in C++: it should allow indexing the
> > method within another instance of the same class (hierarchy).
> 
> yes, but since pike normally compares objects by interface and not by
> identity the only way to establish that an object is the same class by
> identity is within the object itself, as a result it means that only a
> subclass can access protected symbols in a parent class (within the same
> object, but not across objects) otherwise it would mean that anyone
> could circumvent a protected symbol by creating a compatible class

Yeah,. I know this.
And I'm sure that's the reason why the modifier "protected" up to 7.6
was known by the compiler but was a no-op :-)

> 
> > But in Pike 7.8 "protected" is just an alias/a replacement for
> > "static"...
> 
> which i believe was always the intention, to avoid confusion with the
> different definition of static in other languages.

Yeah, and I agree with that :-)
I find it a good solution to rename "static" with "protected".
But in the Parser.XML.DOM module there were some easter eggs...


Greetings,
Reinhard.
(who counts Pike as one of his two favorite scripting languages)

-- 
Reinhard Pfau
mailto:<Reinhard.Pfau[at]gmx.de>