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 NAA10752; Thu, 3 Oct 2002 13:12:15 +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 NAA10763 for ; Thu, 3 Oct 2002 13:12:15 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g93BCE513511 for ; Thu, 3 Oct 2002 13:12:14 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id NAA27030 for caml-list@inria.fr; Thu, 3 Oct 2002 13:12:09 +0200 Date: Thu, 3 Oct 2002 13:12:09 +0200 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] type constructor escape its scope Message-ID: <20021003131209.D26469@verdot.inria.fr> References: <15772.2906.636455.218616@is002258.saclay.cea.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <15772.2906.636455.218616@is002258.saclay.cea.fr>; from basile.starynkevitch@cea.fr on Thu, Oct 03, 2002 at 11:18:18AM +0200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Thu, Oct 03, 2002 at 11:18:18AM +0200, Basile STARYNKEVITCH wrote: > I've got when compiling with > ocamlc -pp "camlp4o pa_extend.cmo" -I +camlp4 -I . -c pa_filtproto.ml > the strange message > > File "pa_filtproto.ml", line 60, characters 7-41: > This expression has type definition_t but is here used with type 'a > The type constructor definition_t would escape its scope This happens typically in this situation: $ cat foo.ml let x = ref [];; type t = C;; x := [C];; $ ocamlc -c foo.ml File "foo.ml", line 3, characters 6-7: This expression has type t but is here used with type 'a The type constructor t would escape its scope The problem is that at the *definition* of "x", the type "t" does not exist yet. The type of "x" is deferred, but is actually "t list ref". But, since "t" is defined after, it would not be possible to defined it with a type constraint: let x = ref ([] : t list);; I did not look at your example, but search something around that. If it is some obscur code generated by Camlp4, it can be more difficult: in this case, I can look at it, if you need. -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr http://cristal.inria.fr/~ddr/ ------------------- 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