Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Observations on OCaml vs. Haskell
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Caml monomorphisation (was Observations on OCaml vs. Haskell)
On Tue, Sep 28, 2004 at 12:10:39PM +0200, Diego Olivier Fernandez Pons wrote:
> > [Richard Jones] shows that:
> >
> > ;;;
> > let max a b =
> >     if a > b then a else b
> > in
> >     print_int (max 2 3)
> > ;;;
> >
> >
> > uses the polymorphic version of '>', even though the use of max here uses
> > only ints.
> 
> Why doesn't Caml compiler specialize the type of [max] ?

It seems to just be a shortcoming of the compiler.

Note that this was observed with 3.06, which is rather ancient version
of OCaml.  It may well work in 3.08.1.

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
If I have not seen as far as others, it is because I have been
standing in the footprints of giants.  -- from Usenet