On Thu, 06 Mar 2003 04:19, Paul wrote:
> Are you speaking in terms of limitation, or requirement?
> It would be nice to have a syntax solution. I've seen p5 interfaces
> with stubs that die so that you have to override them in a subclass. It
> works, but seems a little kludgy.
> And I'm coming in late on this. Are you saying you want
> Exporter/%EXPORT_TAGS functionality built into the language and into
> all objects? Wouldn't that jack up the overhead?

No.  All I'm saying is that this sort of construct:

   *{$_} = \&{"Class::$_"} foreach (qw(method method2 method3));

Gives you everything that inheriting a class does, apart from the ->isa() 
relationship.  And potential unwanted namespace pollution.

I'm thinking along the lines of;

  use base MyActualObjectSuperClass;
  use base XML::Sablotron::DOM => [ "Core" ];

So your class ->isa("MyActualObjectSuperClass"), but ->can() all of the 
Core DOM methods, which could perhaps be tested for as 
->mimics("XML::Sablotron::DOM", "Core"), but also as 
->isa("XML::Sablotron::DOM") for compatibility.

> We musn't dictate style.

No, but we should emanate good style.  And I consider opening two class' 
namespaces into the same stash to be very bad style.

Whenever I've seen Multiple Inheritance used, it has been because the two 
classes inherited are not similar; and you're just doing it to save 
yourself the hassle of splitting it into a ``servant class'' (ie, 
referring to another object & forwarding methods to it).  To re-iterate my 
point, an interface is a `more correct' representation of this 
relationship.  So let's make the semantics of it easy so that people can 
avoid it more easily...

Brent says that `attribute slots in a Parrot object are private to the 
object', so if you really do inherit from two classes, it should be the 
case that one class cannot access the other class' attributes.  But - if 
the child class accesses an attribute which is defined in both classes, 
which does it get?  I think that case (MI two classes with clashing 
symbols) should be a hard run-time error.  If attributes are declared 
explicitly, then this enables this test.  In Perl 5, the approach taken 
with MI namespace clashes is to cross one's fingers ;).
-- 
Sam Vilain, [EMAIL PROTECTED]

"Understanding is a kind of ecstasy."
 -- Carl Sagan

Reply via email to