Here's my two cents: (Maybe a little obvious)

I think ad-hoc overloading should be restricted to functions with the same
number of arguments, otherwise translating Java's
int sum(int a,int b) { /* obvious code here */ }
int sum(int a,int b,int c) { /* ditto */ }
into overloaded Haskell would give a fairly ambiguous type for sum 3 4 
(Int or Int -> Int)
Especially when you have other stuff in your program such as
apply :: Int -> a -> a 
apply (n::Int) _ = error "Can't apply integers!"
apply :: (a -> b) -> a -> b
apply f x = f x 

What would be the value of apply (sum 3 4) 5?

I have thought about overloading sometimes, but typing these examples I
think I'd rather put up with sum2, sum3 etc. (Maybe a nice DWIM IDE with
code completion would be a solution??)

Bye, Jan de Wit





Reply via email to