[clean-list] (no subject)

Edsko de Vries devriese at cs.tcd.ie
Wed Oct 31 10:10:14 MET 2007


On Tue, Oct 30, 2007 at 10:33:55PM +0000, Jigang Sun wrote:
> On page 16 of the book Functional programming in Clean at http://www.st.cs.ru.nl/papers/cleanbook/CleanBookI.pdf, operator + is defined as an overloaded function(class) on different type such as Int, Real etc, so each instance of the class is a different function. While an example of polymorphism using this operator was given 
> 
> double :: a -> a | + a  //defined on Int, Real etc
> double n = n + n
> 
> the function double is defined  in terms of overloaded function.
> 
> my question is now that each operation + carries on a different type is a different function, so each operation the function double do on a separate type should be semantically different. Could anyone advice me the boundary between the two concepts polymorphism and overloading. From the example on the book and the Clean's permission to define a function in terms of overloaded function, the two concepts are mixing together. 

Hey,

You may find it helpful to look at some of the papers that describe how
overloading is implemented. For example, "Implementing Haskell
Overloading" by Lennert Augustsson (Clean overloading works in a similar
way).

Edsko


More information about the clean-list mailing list