Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2004-06-22 (23:32)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Why must types be always defined at the top level?
On Wed, 2004-06-23 at 08:53, Markus Mottl wrote:
> 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?

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

But t is defined here 'at the top level of a module'.

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

Which escapes me. Felix allows types to be defined
anywhere and also allows them to escape, it creates
no problem I'm aware of (except that you can't
name them without resorting to the typeof() operator).

I actually think there is some humour here:

Topic ---------------------Language X ------------ Language Y
Intermodule fun calls         Yes                       No
Intermodule type recursion    Yes                       No
Nest everything (excl funcs)  Yes                       No
Nest funcs                    No                        Yes
Full sep compil               Yes                       No
Platform indep code           No                        Yes

One of these languages is an FP, the other is 'a portable assembler'.
The portable assembler outperforms the FP on most FP like qualities,
but the FP code is actually portable .. [and like Bagley this
isn't a serious comparison :]

John Skaller,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: