>>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.
>
> D'oh! That's a good question--I'll ask in a few minutes and find out. --

Based on normal OO behaviour, I would assume (3) (which is the same as (2)
if there's no override).  the ->SUPER::foo would be called to invoke the
overridden/shadowed version of that signature ...

I would also think that'd be easiest on the parrot, since then it just has
to look for the first thing that matches the signature in all cases,
rather than having logic that checks to see if it needs to invoke the
multimethod logic ... I guess it might slowdown if the override is handled
as a multimethod that goes to the new or callst he next level's multi,
instead of sucking it down and collapsing it for one giant multi ...

--attriel


Reply via email to