[ocaml-platform] Followup to Leo's proposal

Alain Frisch alain.frisch at lexifi.com
Wed Mar 13 15:16:23 GMT 2013


On 03/13/2013 02:53 PM, Leo White wrote:
> I think that the best choice is to use the first semantics since it is
> simpler. This is equivalent to closing the definitions of namespaces
> within a particular source file. This makes sense since there is no real
> benefit to leaving them open.

The problem is that this potentially recreates part of the 
name-collision problem we are trying to avoid.  Doing:

open namespace Core
open namespace Xml

becomes risky because Core might decide to include an Xml sub-namespace 
in the future.  And once it does, one cannot access the toplevel Xml 
namespace anymore in the scope where Core is opened.

Are the limited benefits of hierarchical namespaces worth the trouble?


Also, I still don't see clearly how ocamldep (with and without modules) 
will work with your proposal.  In particular, will "ocamldep -modules" 
still have the property to not do any access to the filesystem except 
for the files explicitly passed to it?  I don't see how to preserve this 
important property without returning only bare module names (with no 
namespace information) as today.  Which means that the resolution logic 
(from module names to files) will have to be redone in the build system 
(as today), but this logic would be much more complex.  Moreover, since 
different namespaces can be opened in different contexts of the source 
code, this information should be reported by ocamldep as well (and 
interpreted by the build system).


Alain


More information about the Platform mailing list