Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Why must types be always defined at the top level?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] Why must types be always defined at the top level?
On Tue, 22 Jun 2004, Richard Jones wrote:
> The subject says it all really.  Why do types need to be defined at
> the top level of a module?  Why isn't it possible to define them in
> some nested scope?

But it is (using local modules):

  let f () =
    let module M = struct
      type t = Foo
    end in
    M.Foo = M.Foo

Note that you cannot return values such that the module name escapes
its scope.

Regards,
Markus

-- 
Markus Mottl          http://www.oefai.at/~markus          markus@oefai.at

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