Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Suggestion for overloaded operators
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Francois Pottier <francois.pottier@i...>
Subject: Re: [Caml-list] Suggestion for overloaded operators

On Sun, Feb 10, 2002 at 02:04:45PM +0100, Warp wrote:
>
> The compiler will seek for a function named :
>     typea_add_typeb : typea -> typeb -> typer

Your proposal is reasonable, but you forget that typea and typeb might be
unknown, and might remain unknown for quite a while. For this reason,
overloading poses a difficult type inference problem. One elegant way to solve
it is embodied by Haskell's type classes:

  P. Wadler and S. Blott.
  How to make ad-hoc polymorphism less ad-hoc. 
  ftp://ftp.dcs.gla.ac.uk/pub/glasgow-fp/authors/Philip_Wadler/how-to-make-ad-hoc-poly-less-ad-hoc.dvi

You may also wish to have a look at another interesting paper on the
topic:

  Martin Odersky, Philip Wadler, and Martin Wehr.
  A second look at overloading.
  http://lampwww.epfl.ch/~odersky/papers/fpca95.ps.gz

Cheers,

-- 
François Pottier
Francois.Pottier@inria.fr
http://pauillac.inria.fr/~fpottier/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr