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 TAA21224; Tue, 3 Feb 2004 19:06:53 +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 TAA24684 for ; Tue, 3 Feb 2004 19:06:52 +0100 (MET) Received: from avalon.ens-lsh.fr (mailhost.ens-lsh.fr [193.51.131.2]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id i13I6pP29191 for ; Tue, 3 Feb 2004 19:06:51 +0100 (MET) Received: from avalon.ens-lsh.fr (localhost [127.0.0.1]) by avalon.ens-lsh.fr (8.12.8/8.12.8) with ESMTP id i13J5KbS004675 for ; Tue, 3 Feb 2004 19:05:20 GMT Received: from ens-notes1.ens-lsh.fr (ens-notes1.ens-lsh.fr [10.2.1.44]) by avalon.ens-lsh.fr (8.12.8/8.12.8) with ESMTP id i13J5KEu004672 for ; Tue, 3 Feb 2004 19:05:20 GMT Received: from mostha ([10.3.20.31]) by ens-notes1.ens-lsh.fr (Lotus Domino Release 5.0.10) with SMTP id 2004020319064899:2765 ; Tue, 3 Feb 2004 19:06:48 +0100 Date: Tue, 3 Feb 2004 19:06:35 +0100 From: Damien To: caml-list@inria.fr Subject: [Caml-list] functors and objects Message-Id: <20040203190635.6cc61ff0.Damien.Pous@ens-lyon.fr> Organization: mosthagloups X-Mailer: Sylpheed version 0.9.6claws (GTK+ 1.2.10; i386-pc-linux-gnu) Mime-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on ens-notes1/ENS-LSH(Release 5.0.10 |March 22, 2002) at 03/02/2004 19:06:49, Serialize by Router on ens-notes1/ENS-LSH(Release 5.0.10 |March 22, 2002) at 03/02/2004 19:06:50, Serialize complete at 03/02/2004 19:06:50 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; damien:01 damien:01 ens-lyon:01 functors:01 sigh:01 struct:01 struct:01 unsound:01 functor:01 inherit:01 inherit:01 sig:01 sig:01 modules:02 objects:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello, I would like to write something like << class type o = object method react: unit end module type O = sig type t :> o (* sigh... *) end module R(M: O) = struct let l: M.t list ref = [] let register (o: M.t) = l := o :: !l let react() = List.iter (fun o -> o#react) !l end >> and then, in a second layer, something like << class type o' = object inherit o method render: unit end module type O' = sig type t :> o' end module R(M: O') = struct include R(M) let render() = List.iter (fun o -> o#render) !l end >> I tried all sort of tricks with #o, type 'a t = #o as 'a ... but I didn't managed to to it :( (without turning my objects into plain modules) Any idea ? Is it unsound to let a functor use an object type ? (not to inherit from the class, just to use the methods of objects belonging to this type) thanks, damien ------------------- 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