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-29 (01:40)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] "OCaml gives you only monomorphic methods in classes."
On Saturday 29 December 2007 01:19:53 Gordon Henriksen wrote:
> Oh, were you proposing a language feature? In that case, consider:
> let bar x = foo x
> How to compile that?

The call to "foo" uses an argument with the type '_a. That is the bail case, 
giving an error saying that overloads require type annotations. I think this 
is exactly what F# does. If you wanted to be more fancy you could allow that 
and just copy the requirements upon "x". So if you know foo's argument is 
[int|string] then bar's argument would also be [int|string].

I'm not proposing language features so much as just trying to understand 
Martin's assertion that integrating statically-typed FP with 
nominally-subtyped OOP is an unsolved problem. This doesn't even seem hard, 
let alone unsolved, but I can't think what I'm missing.

Dr Jon D Harrop, Flying Frog Consultancy Ltd.