English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net

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