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
Nesting Modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-11-02 (11:18)
From: Tom Hawkins <tom@c...>
Subject: Re: [Caml-list] Nesting Modules
Richard Jones wrote:
> On Tue, Nov 01, 2005 at 10:59:27AM -0600, Tom Hawkins wrote:
>>Can I instruct the compiler to nest Bottom somewhere in Top, to obtain 
>>clean, hierarchical names (eg: Top.Bottom.some_function)?  Of course I 
>>can inline bottom.ml in top.ml, but then the file become rather large.
> If you want clean, hierarchical names it's much better to use '_' to
> separate the hierarchies (eg. Top_Bottom).  The reason for this is
> that it allows others to extend your hierarchy by adding other modules
> (eg. someone else can easily then create Top_MyExtension).
> This means a bit of file renaming:
>   top.mli
>   top.ml
>   top_Bottom.mli
>   top_Button.ml

But then you're forced to 
Drag_Along_Every_Module_To_Get_To_Something.useful.  ;-)  As a library 
user, I would much prefer:

   open Drag.Along.Every.Module.To.Get.To
   Something.useful ()