[ocaml-platform] on the need and design of OCaml namespaces

Leo White lpw25 at cam.ac.uk
Mon Feb 25 11:35:09 GMT 2013


>Are you suggesting that support for namespace would require to change 
>make and omake, or just their "OCaml-specific" rules (defined in user 
>land, not in the tool itself)?

Just their OCaml-specific rules.

>I'm not sure that what you describe above correspond to phony targets as 
>currently understood by make and omake (I might be wrong).

I think that a phony target is just a target without a corresponding file 
(I might also be wrong).

Although, I had forgotten the OCamlDep only creates dependencies on modules 
that have an existing .ml or .mli file. So instead of using phony targets, 
I propose the following solution:

 - Whenever it finds a use A#B#C in a file e.mli it creates a dependency
   "e.cmi: c.cmi" if it can find an ".mli" or ".ml" file in its search path 
   which starts with the line "in A#B".
 
 - Build systems are left as they are.

>Could you also describe how this would be affected if we allow opening 
>namespaces?  It seems to me that the safe thing to do would be quite 
>ugly (a reference to a module "A" would create many candidate 
>dependencies for all opened namespaces).

With the solution given above, a reference to "A" would only create a 
dependency on the "a.cmi" that was in the more recently opened namespace.

> Moreover, would you support 
>opening namespaces within namespaces (i.e. is "open namespace A;; open 
>namespace B" a valid way to open the namespace A/B?)

I would like to but it is not a deal-breaker.



More information about the Platform mailing list