Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: brogoff <brogoff@s...>
Subject: Re: [Caml-list] "OCaml gives you only monomorphic methods in classes."
On Fri, 28 Dec 2007, 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

What's the date that quote was made? It was probably made before
polymorphic methods were added to OCaml from OLabl.

> In what way must methods be monomorphic in OCaml classes?

They don't need to be.  See section 3.11 of "Objects in Caml" of the
manual.

-- Brian