Generic function: Difference between revisions

Content deleted Content added
m distinguish generalized function
CmdrObot (talk | contribs)
m sp: An other→Another
Line 4:
Generic functions correspond roughly to what [[Smalltalk]] calls messages; but when a generic function is called, method dispatch occurs on the basis of all arguments, not just a single privileged one. See under [[multiple dispatch]] for more. This is also known as a [[multimethod]].
 
An otherAnother, 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 = a