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
"OCaml gives you only monomorphic methods in classes."
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-12-28 (23:55)
From: Gordon Henriksen <gordonhenriksen@m...>
Subject: Re: [Caml-list] "OCaml gives you only monomorphic methods in classes."
Jon, consider the case of Java or C++ method (and function)  
overloading. This form of static dispatch is quite distinct from  
virtual method dispatch, and is indeed at odds with type inference.

- Gordon

On Dec 28, 2007, at 16:37, Jon Harrop <> wrote:

> I just read this quote and I do not understand what it means:
>  "In particular, the Hindley/Milner style of type inference used in  
> languages
> such as OCaml or Haskell is incompatible with lots of assumptions of  
> OO
> languages. One incompatibility is with overloading. That's why OCaml  
> does not
> let you write + for both integer and floating point addition. Another
> incompatibility is with higher order polymorphism. That's why OCaml  
> gives you
> only monomorphic methods in classes." - Martin Odersky
> In what way must methods be monomorphic in OCaml classes?
> -- 
> Dr Jon D Harrop, Flying Frog Consultancy Ltd.
> _______________________________________________
> Caml-list mailing list. Subscription management:
> Archives:
> Beginner's list:
> Bug reports: