caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Eric C. Cooper" <ecc@cmu.edu>
To: ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] what does this mean?
Date: Tue, 16 Apr 2002 14:06:11 -0400	[thread overview]
Message-ID: <20020416180611.GB586@cmu.edu> (raw)
In-Reply-To: <3CBC5F37.1DC83003@sage.att.com>

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


  reply	other threads:[~2002-04-16 18:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-16 17:28 Garry Hodgson
2002-04-16 18:06 ` Eric C. Cooper [this message]
2002-04-16 19:26   ` Garry Hodgson
     [not found] ` <3CBC64F8.B677F621@recherche.enac.fr>
     [not found]   ` <3CBC7B46.9EB83B57@sage.att.com>
2002-04-17  9:18     ` Nicolas barnier
2004-04-13  4:26 [Caml-list] What " skaller
2004-04-13 14:00 ` skaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020416180611.GB586@cmu.edu \
    --to=ecc@cmu.edu \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).