caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jean-Marie Gaillourdet <jm@gaillourdet.net>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Type from local module would escape its scope?
Date: Mon, 3 Jul 2006 15:38:00 +0200	[thread overview]
Message-ID: <ABCD64B4-0E93-4C3A-82C7-EC59D0B44916@gaillourdet.net> (raw)
In-Reply-To: <069A1F65-E50C-4363-9CCA-C6CC9A453D09@vub.ac.be>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

On 03.07.2006, at 15:19, Bruno De Fraine wrote:
> While the following is rejected:
>
> let foo (ignore: 'a -> unit) =
>   let module Foo : FOO =
>   struct
>     type t = int
>     let value = 1
>   end in
>   ignore Foo.value
> ;;
>
> With an error on the expression "Foo.value" stating that "The type  
> constructor Foo.t would escape its scope". Reading about the  
> typical case for this error message in http://caml.inria.fr/pub/ml- 
> archives/caml-list/2002/10/0cf087feab3ef8dc5ccba5a8592472fb.en.html  
> didn't really help me. Why does it make a difference whether ignore  
> is an argument?

Let us extend your example with the following code:

> let foo (ignore: 'a -> unit) =
>   let module Foo : FOO =
>   struct
>     type t = int
>     let value = 1
>   end in
>   ignore Foo.value

> ;;

let bar (ignore: 'b -> unit) =
   let module Foo : FOO =
   struct
     type t = float
     let value = 1.0
   end in
   ignore Foo.value

let baz () =
   let x = ignore in begin
     foo x;
     bar x
   end

Which type should x have?

Best Regards,
   Jean-Marie

PS: didn't compile that code

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFEqR28NIUNP/I5YOgRAoRcAKDKWlxVFBKYfdmBvPJ/T2LYrwKu+ACfYJnK
LUIeev+RCMoifUFF5ZNJVK0=
=mEs/
-----END PGP SIGNATURE-----


  parent reply	other threads:[~2006-07-03 13:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-03 13:19 Bruno De Fraine
2006-07-03 13:23 ` [Caml-list] " Jonathan Roewen
2006-07-03 13:38 ` Jean-Marie Gaillourdet [this message]
2006-07-03 13:45 ` Alain Frisch
2006-07-03 13:51 ` Virgile Prevosto
2006-07-03 14:23   ` skaller
2006-07-03 14:50   ` Bruno De Fraine
2006-07-03 15:10     ` Jonathan Roewen
2006-07-03 17:30   ` Petty complaint (Was Re: [Caml-list] Type from local module would escape its )scope? brogoff
2006-07-03 18:50     ` Etienne Miret
2006-07-04 21:08     ` Boris Yakobowski

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=ABCD64B4-0E93-4C3A-82C7-EC59D0B44916@gaillourdet.net \
    --to=jm@gaillourdet.net \
    --cc=caml-list@yquem.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).