3 ms·
i rather more like OCaml's way of doing things that often releases one entirely from having to write module inclusion directives, since in general bindings are
by Blikkentrekker 6y ago
i rather more like OCaml's way of doing things that often releases one entirely from having to write module inclusion directives, since in general bindings are qualied by their module name which becomes part of their namespace. So one would use `Array.map` in code, which is the `map` binding exported by the `Array` module, and the `Array` module is then included automatically, of course. This would be `array_map` in many languages to avoid conflicts, but modules in OCaml deliberately export short names on the expectation that bindings will be namespace qualified with their module name.
It is possible to explicitly open this module, so that one can use `map` instead, but that's generally not wise.
I find having to write a long list of include directives at the top of a file quite annoying, and this also does not betray in what module exactly bindings are defined that one might encounter in the code below them. If I encounter, say, `Net.Tcp.open` in Ocaml code, I know that this function is defined in `./net/tcp.ml`.