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
[Caml-list] record declaration, SML
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] record declaration, SML

On Fri, Jan 10, 2003 at 12:14:17AM +0100, Alessandro Baretta wrote:
> Interesting solution. However, Ocaml does not support 
> defining objects on the fly. The following
>  > let c = new object method f = 1 end in C c
> is not valid Ocaml.

You can do this:

  let module M =
      class a = object val f = 1 method f = f end
  C (new M.a)

It is a little bit tricky, but useful in an automatic translation
from SML to OCaml.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: