From: Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] type constructor escape its scope
Date: Thu, 3 Oct 2002 13:12:09 +0200 [thread overview]
Message-ID: <20021003131209.D26469@verdot.inria.fr> (raw)
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
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
prev parent reply other threads:[~2002-10-03 11:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-03 9:18 Basile STARYNKEVITCH
2002-10-03 11:12 ` Daniel de Rauglaudre [this message]
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=20021003131209.D26469@verdot.inria.fr \
--to=daniel.de_rauglaudre@inria.fr \
--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).