The use of CamelCase in OCaml

Continuing the discussion from OCaml Style guide?:

I wonder if any of the style guides supports using CamelCase for modules, to distinguish them from variant constructors? (If not, I’ll adapt.)

In case someone does use CamelCase for modules, do you name your files camelCase.ml, or CamelCase.ml? (Long ago, the latter was not allowed by the toolchain, but then it became allowed.)

The containers library from @c-cube uses CamelCase for at least some of its modules, see .e.g CCBitField, CCHashTrie, and the files use CamelCase.ml (see ocaml-containers/src/data at master · c-cube/ocaml-containers · GitHub ).

I’ve occasionnaly used CamlCase for modules, and personally my preference is to stick with Snake_case for module name, which I find more readable.

(But: I dislike even more the occasional convention to use UPPERCASE for module types. Urgh.)

2 Likes