[Prev][Next][Index][Thread]
Re: Multiple dispatch / multimethods??
Gary Stephenson wrote:
> Sorry, but I don't understand. I wish to compare not "overriding" (i.e.
> inheritance) but "overloading". For the sake of the argument we might even
> define one big (huge!) GenericFunction class containing a (separate) set of
> overloaded static methods for each generic function we wish to implement.
> Ignoring the issue of compile-time v. run-time resolution, how closely does
> the signature-based mechanism the Java compiler uses to select the
> appropriate method to "dispatch to" resemble the "multiple-dispatch"
> mechanism employed by the Dylan compiler/runtime's generic function
> implementation?
Overloaded Java methods have no next-method(), #key, #rest, or the use of "apply".
Generic functions require that all methods be congruent (i.e., the same number of required arguments, arguments in the same positions must be subtypes of the types declared for the same positions in the generic, and a few other rules). Overloaded Java methods don't have those restrictions.
References: