Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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 ()


-Tom