> Thinking about what Zhang was saying about multiple-dispatch not being
> inherently OO. I think he's sort of right. Multiple-dispatch need
> not be confined to method lookups.
True, but that doesn't make it non-OO ;-)
> foo();
> foo($bar);
> foo($baz);
> foo($bar, $baz);
>
> sub foo () : multi { ... }
> sub foo (Bar $bar) : multi { ... }
> sub foo (Baz $baz) : multi { ... }
Yes. Ordinary subroutine overloading (like that offered by C++)
certainly does fall out as a happy side-effect of multiple dispatch
in dynamic languages.
For example, see:
http://dev.perl.org/rfc/256.html#Handling_built_in_types
But note that the *run-time* dispatch of these overloaded subroutines
is still critically important because of Perl's dynamic typing of values
within container data structures.
Damian