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 NAA05096; Mon, 4 Nov 2002 13:41:45 +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 NAA06156 for ; Mon, 4 Nov 2002 13:41:44 +0100 (MET) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gA4Cfh529612 for ; Mon, 4 Nov 2002 13:41:43 +0100 (MET) Received: from akasha.ijm.jussieu.fr (akasha.ijm.jussieu.fr [134.157.173.57]) by shiva.jussieu.fr (8.12.5/jtpda-5.4) with ESMTP id gA4CfhjR022782 ; Mon, 4 Nov 2002 13:41:43 +0100 (CET) Received: by akasha.ijm.jussieu.fr (Postfix, from userid 11004) id 301EB3C46C; Mon, 4 Nov 2002 13:41:38 +0100 (CET) From: Olivier Andrieu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15814.27393.880341.225808@akasha.ijm.jussieu.fr> Date: Mon, 4 Nov 2002 13:41:37 +0100 To: pan deng Cc: caml-list@inria.fr Subject: Re: [Caml-list] how to open types In-Reply-To: <20021104082539.18529.qmail@web11103.mail.yahoo.com> References: <20021104082539.18529.qmail@web11103.mail.yahoo.com> X-Mailer: VM 7.07 under Emacs 20.7.1 X-Antivirus: scanned by sophie at shiva.jussieu.fr Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk pan deng [Monday 4 November 2002] : > > I want to use hashtable on my objects which all has a > method get_string:string. > but i can only write the code like these: > > module SeqHashType = > struct > type t= > let equal s1 s2 = (String.uppercase s1#get_string > =String.uppercase s2#get_string ) > let hash s = Strex.hash s#get_string > end > module SeqHashtbl = Hashtbl.Make (SeqHashType) > > surely it is not what i want . i have tried > type t= > > but i can not complie it , the complier says Unbound > .. Yes, "open" object type have an implicit type parameter that you have to specify in the definition : type 'a t = 'a constraint > then how to open the type in the > module SeqHashType ? > or it can not be opened at this situation ? You cannot because in the module signature Hashtbl.HashedType, type t isn't polymorph. I guess the solution would be to use type t = and to coerce your objects to this (o :> SeqHashType.t) -- Olivier ------------------- 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