develooper Front page | perl.perl6.language | Postings from February 2004

Fwd: Re: OO inheritance in a hacker style

Thread Next
Joseph Ryan
February 4, 2004 14:21
Fwd: Re: OO inheritance in a hacker style
Message ID:
Woops, sent it to the wrong list!

- Joe

Joseph Ryan wrote:

>  Luke Palmer wrote:
>> Austin Hastings writes:
>>>> Hmm. The text and examples so far have been about methods and this
>>>> seems to be about multi-methods.  Correct me if I'm wrong ...
>>> You're wrong. Consider my example, where via single inheritance we 
>>> reach a
>>> "layered" list of methods, each of which replaces the previous one 
>>> in the
>>> namespace (parent.method superseded by child.method). This is not
>>> multi-dispatch -- the class of the object being dispatched 
>>> determines the
>>> method -- but I want to modify the dispatch chain so that some upstream
>>> class' method is "ignored".
>> It's surely possible by modifying that class's DISPATCH. 
>> Whether it should actually be in the language is up for debate.  I'd say
>> that if you need to do this with any frequency whatsoever, you're not
>> thinking about roles right.  A good example might be in order... :-)
> Well, what if the two classes you want to inherit from weren't
> designed with roles in mind?  For instance, there might be two
> CPAN modules that each have a dozen methods that you want to
> inherit, but they each have 1 that overlap whose conflict you
> want to easily resolve.
> Besides, "the user is not thinking about XXX right" sounds like we
> need to give a ++ to the pythonometer ;)
> - Joe

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About