Qui, 2008-06-05 às 15:43 -0700, Larry Wall escreveu: > Maybe it's just a temporary lack of imagination, but I'm having trouble > these days coming up with any kind of a use case for confusing single > dispatch with multiple dispatch. Yeah, I know I wrote that, but I was > either smarter or stupider back then...
Let me try... :) { class Foo { method bar(Num $a) {...} } sub bar(Foo $f, Str $b) {...} Foo $f .= new; # This would dispatch the method bar $f.bar(1); # should it fallback? even if method bar is not multi? $f.bar("Hello"); } I think it could be resumed to the following truth table: For $f.bar("hello") does it fallback? method | sub | fallback? ---------------------------------------- multi | multi | yes multi | single | yes? single | multi | no? single | single | no? My initial idea was that it would allways fallback if the method dispatch fails. Which would mean that this belongs to the interpreter dispatcher, not to the object dispatcher (what makes sense, since you need lexical information to do this). If that is not the case, there are two options: 1) There are two failure types for the object dispatch, which would trigger or not the fallback... 2) The object dispatcher is the one responsible for doing the fallback (using CALLER:: to find the sub. I personally think option 2 is the the uglyiest one in terms of implementation... daniel