Comparison To Other Languages
Generic functions correspond roughly to what Smalltalk calls methods, with the notable exception that, in Smalltalk, the receiver's class is the sole determinant of which body of code is actually called: the types or values of the arguments are irrelevant (single dispatch). In a programming language with multiple dispatch when a generic function is called, method dispatch occurs on the basis of all arguments, not just a single privileged one. New Flavors also provided generic functions, but only single dispatch.
Another, completely separate definition of generic function is a function that uses parametric polymorphism. This is the definition used when working with a language like OCaml. An example of a generic function is
id: a->a let id a = awhich takes an argument of any type and returns something of that same type.
Read more about this topic: Generic Function
Famous quotes containing the words comparison to, comparison and/or languages:
“It is very important not to become hard. The artist must always have one skin too few in comparison to other people, so you feel the slightest wind.”
—Shusha Guppy (b. 1938)
“Certainly there is not the fight recorded in Concord history, at least, if in the history of America, that will bear a moments comparison with this, whether for the numbers engaged in it, or for the patriotism and heroism displayed.”
—Henry David Thoreau (18171862)
“I am always sorry when any language is lost, because languages are the pedigree of nations.”
—Samuel Johnson (17091784)