[clean-list] (no subject)
Marco Kesseler
m.kesseler at xs4all.nl
Wed Oct 31 21:25:42 MET 2007
Hmmm, although it may be enlightening to look at implementations, I
think the question becomes more interesting if we leave
technicalities aside and ask ourselves whether it should really be
necessary to classify functions as being "polymorphic" or "overloaded".
I mean: if a programmer writes down some expression - and assuming he
even realizes that some term relates to some type variable "a" -, is
it really that important whether we know something about the
structure of the type or something about its "interface".
Essentially:
double n = n + n
versus
double n = n ++ n
On 31-okt-2007, at 10:10, Edsko de Vries wrote:
> 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
> _______________________________________________
> clean-list mailing list
> clean-list at science.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/clean-list
>
More information about the clean-list
mailing list