[ocaml-platform] Unique file names
Romain Bardou
romain.bardou at inria.fr
Mon Mar 4 14:28:45 GMT 2013
Hello,
It seems to me that long names break modularity. By modularity I mean
the ability to name a unit (a file, a value...) with no knowledge of its
environment.
Let's say I am developing project "Video3D" for which I developed a
"Quadtree" module. I name it "Video3D_Quadtree". Now, let's say that
Batteries and Core want to integrate my quadtree implementation. They
will rename the module as "Batteries_Quadtree" and "Core_Quadtree".
There is no way to chose a name that does not depend on the environment
if I use long unique names. Long unique names are explicitely giving up
on modularity.
Long names feel like having to write code like this:
type 'list_t_a list_t =
| List_empty
| List_cons of 'list_t_a * 'list_t_a list_t
let rec list_map list_map_f list_map_l =
match list_map_l with
| List_empty ->
List_empty
| List_cons (list_map_value, list_map_tail) ->
let list_map_value = list_map_f list_map_value in
let list_map_tail = list_map list_map_f list_map_tail in
List_cons (list_map_value, list_map_tail)
Everything which is defined in unit U is prefixed by "U_". Here, I have
the "list" unit (the module) and the "list_map" unit. But thanks to
modularity I can choose any name for "list_map_f" and "list_map_l".
Because I am inside unit "list_map", these names are redundant and I can
use "f" and "l" instead.
It should be the same for compilation units: I should be able to name my
module "Quadtree". Namespaces should then provide a way to integrate
this name in another environment, if needed.
Cheers,
--
Romain Bardou
More information about the Platform
mailing list