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 UAA18874; Tue, 16 Apr 2002 20:07:10 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA14551 for ; Tue, 16 Apr 2002 20:07:08 +0200 (MET DST) Received: from ux9.sp.cs.cmu.edu (UX9.SP.CS.CMU.EDU [128.2.220.166]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id g3GI77521496 for ; Tue, 16 Apr 2002 20:07:08 +0200 (MET DST) Received: from 12-226-37-231.client.attbi.com ([12.226.37.231]) by ux9.sp.cs.cmu.edu id aa16289; 16 Apr 2002 14:06 EDT Received: from ecc by stratocaster with local (Exim 3.35 #1 (Debian)) id 16xXLH-0000B7-00 for ; Tue, 16 Apr 2002 14:06:11 -0400 Date: Tue, 16 Apr 2002 14:06:11 -0400 To: ocaml Subject: Re: [Caml-list] what does this mean? Message-ID: <20020416180611.GB586@cmu.edu> Mail-Followup-To: ocaml References: <3CBC5F37.1DC83003@sage.att.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3CBC5F37.1DC83003@sage.att.com> User-Agent: Mutt/1.3.28i From: "Eric C. Cooper" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, Apr 16, 2002 at 01:28:23PM -0400, Garry Hodgson wrote: > > i'm getting en error message i don't understand in the following code > fragment. foo.ml is: > > let regions = Hashtbl.create 64 > > type region = { name:string; coords:(int*int*int*int); countries:string > list } > > let addRegion name0 coords0 ccs = > let r = { name=name0; coords=coords0; countries=ccs } in > Hashtbl.add regions name0 r > > when i comp[ile, i get: > > $ ocamlc foo.ml > File "foo.ml", line 9, characters 13-20: > This expression has type ('a, 'b) Hashtbl.t but is here used with type > (string, region) Hashtbl.t > The type constructor region would escape its scope > > can someone explain what this means, and perhaps how to resolve it? > thanks The problem is that you create the regions hash table before defining the region type. Just move the type definition to the top, before creating any data structures that might use it. -- Eric C. Cooper e c c @ c m u . e d u ------------------- 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