From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA14419; Fri, 10 Jan 2003 03:59:41 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA14355 for ; Fri, 10 Jan 2003 03:59:40 +0100 (MET) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h0A2xdr06642 for ; Fri, 10 Jan 2003 03:59:39 +0100 (MET) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id DAA23561 for caml-list@inria.fr; Fri, 10 Jan 2003 03:59:39 +0100 Date: Fri, 10 Jan 2003 03:59:39 +0100 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] record declaration, SML Message-ID: <20030110035939.A23551@verdot.inria.fr> References: <20030109234207.B19061@verdot.inria.fr> <3E1E0249.6050102@baretta.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3E1E0249.6050102@baretta.com>; from alex@baretta.com on Fri, Jan 10, 2003 at 12:14:17AM +0100 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, 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 = struct class a = object val f = 1 method f = f end end in C (new M.a) It is a little bit tricky, but useful in an automatic translation from SML to OCaml. -- Daniel de RAUGLAUDRE http://cristal.inria.fr/~ddr/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners