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 QAA03208; Mon, 14 Jun 2004 16:48:32 +0200 (MET DST) 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 QAA03024 for ; Mon, 14 Jun 2004 16:48:30 +0200 (MET DST) Received: from psyche.kaba.or.jp (psyche.kaba.or.jp [202.249.19.1]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i5EEmSSH009256 for ; Mon, 14 Jun 2004 16:48:29 +0200 Received: from mail.kaba.or.jp (cascade.kaba.or.jp [202.249.19.34]) by psyche.kaba.or.jp (Postfix) with ESMTP id 8AB8222B41; Mon, 14 Jun 2004 23:48:27 +0900 (JST) Received: from localhost (klingon.kaba.or.jp [202.249.19.14]) by mail.kaba.or.jp (Postfix) with ESMTP id 6698C49A6D; Mon, 14 Jun 2004 23:48:27 +0900 (JST) Date: Mon, 14 Jun 2004 23:48:27 +0900 (JST) Message-Id: <20040614.234827.74677774.keiko@kaba.or.jp> To: IdeFX@Iname.com Cc: caml-list@inria.fr, keiko@kaba.or.jp Subject: Re: [Caml-list] troubles with polymorphic variant in class From: nakata keiko In-Reply-To: <1087142756.10383.50.camel@Bess> References: <1087142756.10383.50.camel@Bess> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 40CDBABC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 struct:01 struct:01 val:01 caml:01 mutable:01 sig:01 sig:01 rec:01 polymorphic:01 variant:02 module:03 module:03 unit:03 object:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I hope this would be of some help. module type Ct = sig type t end module type Crec = sig module T : Ct class button : object method add_child : T.t -> unit end end module COt(Crec : Crec) = struct type t = [`Whatever|`Button of Crec.button] end module CO(Crec : Crec) = struct module T = COt(Crec) class button = object val mutable children : T.t list = [`Whatever] method add_child x = children <- x::children end end module rec X : (Crec with module T = COt(X)) = CO(X) As I done, you can specify the type of elements of the list "children" inside "COt". The above code is taken from http://caml.inria.fr/archives/200403/msg00344.html with best regards. ------------------- 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