Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
RE: [Caml-list] Operator overloading
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-03-09 (10:20)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Operator overloading
On Friday 09 March 2007 09:32, Tom wrote:
> Basically, I agree with you. I'm just saying that you can further increase
> the "typeclass" of length-able objects to almost anything. Why limit
> ourselves?

Because there is a tradeoff between type inference and overloading. Operators 
are conventionally heavily overloaded (e.g. in maths) and having overloaded 
operators works well. Allowing all functions to be overloaded weakens 
inference more and doesn't buy you so much, so you must choose to draw the 
line somewhere.

I would like to have "sin" work on float and float32 in F# though... :-)

Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists