Related articles |
---|
Polymorphism vs. Overloading gdevivo@conicit.ve (1994-10-22) |
Re: Overloading vs. Polymorphism heronj@smtplink.NGC.COM (John Heron) (1994-10-31) |
Newsgroups: | comp.compilers |
From: | John Heron <heronj@smtplink.NGC.COM> |
Keywords: | polymorphism |
Organization: | Compilers Central |
References: | 94-10-144 |
Date: | Mon, 31 Oct 1994 22:24:59 GMT |
gdevivo@concit.ve writes
>the difference between polymorphism and Overloading
My understanding of this is Overloading is an ad hoc method of
implementing polymorphism. A polymorphic function is one that takes a
range (possibly quantified universally) of types as its domain(s). An
overloaded function or operator is one that has multiple definitions for
the different types, one for each domain it supports. The ad-hoc nature
usually has to do with the mapping of the operator or function to the
associated instance or method and its restricted domain.
There are 2 basic types of overloading: dynamic (like smalltalk), where
the domain of the function and its associated method are determined by
the tag in a discriminated union at run time, usually through a dispatch
table. The second type is static (like ML, miranda, or Haskell) where
the associated method can be determined by checking the type of the
argument and the declaration of the class at compilation time.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.