On Fri, Feb 07, 2003 at 09:39:14AM -0800, Dan Sugalski wrote:
> It's a little more confusing that that. When I said only one foo 
> method, it was in contrast to attributes, where an attribute of a 
> particular name may appear in an object multiple times--since 
> attributes are class-private, each class in an object's inheritance 
> hierarchy can safely have an attribute named "foo".
> 
> Methods and properties, being global, override each other--a child 
> class' foo overrides its parent's foo. If the child's foo has 
> multiple definitions based on signature, or we have foo that crosses 
> class lines, then the multiple dispatch logic comes online and does 
> its Weird Magic.
> 
> Rereading that, it still doesn't make much sense, but there you go... :)

Just to confuse things more, there is a question I have reguarding
multi-methods and inheritance.

Consider class A defines foo() as a multi-method with 3 different signatures

If class B then sub-classes A and defines a method foo() does it

1 override all foo() methods in A
2 get added to the foo() methods in the dispatch, so we now have
  a multi-method with 4 signatures
3 override only the method in A that has the same signature

My guess would be (1) and that multi-method distpatch would
only happen if B called ->SUPER::foo

In which case you could consider that there is only one method
named foo(). That method does the dispatch to the others.

Now I am probably not making sense :)

Graham.

Reply via email to