Multiple dispatch again

Gary Duzan gary at duzan.org
Mon Jan 6 13:09:24 EST 2003


In article <m2smw9ziob.fsf at mycroft.actrix.gen.nz>,
Paul Foley  <see at below.invalid> wrote:
=>On Fri, 3 Jan 2003 21:12:31 -0500, John Roth wrote:
=>
=>> If I understand what you're talking about, multiple dispatch is
=>> simply another name for method overloading - or is it?
=>
=>No, it isn't.

   To be more specific, method overloading can be viewed as a static
form of multiple dispatch. That is, while syntactically the call
looks like a call to a single method, the compiler determines one
of several methods which should be used and generates code to call
that method.

   On the other hand, what is being discussed here would be a
dynamic multiple dispatch, in that the determination of which method
to call must be delayed until run time. A virtual method call is
considered a single dynamic dispatch, in that it only uses a single
piece of information (i.e. the target object class) at run time to
determine the actual method to invoke. A dynamic multiple dispatch
requires examining multiple pieces of information (e.g. the target
object class and the type/class of the parameters.)

   You can read an interesting paper about adding dynamic multiple
dispatch to Java here:

	http://stillwater.csd.uwo.ca/~wade/Research/MDJ/

					Gary Duzan
					BBN Technologies
					A Verizon Company







More information about the Python-list mailing list