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
- Re: View on true ad-hoc overloading. Kevin Atkinson
- Re: View on true ad-hoc overloading. Fergus Henderson
- Re: View on true ad-hoc overloading. Fergus Henderson
- Re: View on true ad-hoc overloading. Fergus Henderson
- Re: View on true ad-hoc overloading. Fergus Henderson
- RE: View on true ad-hoc overloading. Brian Boutel
- Re: View on true ad-hoc overloading. Olaf Chitil
- Re: View on true ad-hoc overloading. Kevin Atkinson
- Re: View on true ad-hoc overloading. Hans Aberg
- RE: View on true ad-hoc overloading. Hans Aberg
- Re: View on true ad-hoc overloading. Jan de Wit
- Re: View on true ad-hoc overloading. Carlos Camarao de Figueiredo
- Re: View on true ad-hoc overloading. Jon . Fairbairn
- Re: View on true ad-hoc overloading. Hans Aberg
- RE: View on true ad-hoc overloading. Patrick Logan
- Re: View on true ad-hoc overloading. S. Alexander Jacobson
- Re: View on true ad-hoc overloading. Fergus Henderson
- Re: View on true ad-hoc overloading. Carlos Camarao de Figueiredo
- Re: View on true ad-hoc overloading. Fergus Henderson
- Re: View on true ad-hoc overloading. Patrick Logan
- Re: View on true ad-hoc overloading. Nigel Perry
