caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Type from local module would escape its scope?
@ 2006-07-03 13:19 Bruno De Fraine
  2006-07-03 13:23 ` [Caml-list] " Jonathan Roewen
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Bruno De Fraine @ 2006-07-03 13:19 UTC (permalink / raw)
  To: caml-list

Hello list,

I don't quite understand this behavior regarding local modules (in  
OCaml 3.09.2):

The following is accepted:

module type FOO =
sig
   type t
   val value : t
end ;;

let foo () =
   let module Foo : FOO =
   struct
     type t = int
     let value = 1
   end in
   ignore Foo.value
;;

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?

Thanks,
Bruno


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2006-07-04 21:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-03 13:19 Type from local module would escape its scope? Bruno De Fraine
2006-07-03 13:23 ` [Caml-list] " Jonathan Roewen
2006-07-03 13:38 ` Jean-Marie Gaillourdet
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

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).