Capitalized_underscore vs CamelCase

Maybe you should try to see that from another perspective.

OCaml uses snake casing, as the programming guidelines will tell you. However, as the manual will explain to you, the language does make distinctions in certain contexts between capital and lowercased identifiers. Namely constructors and module names do start with a capital letter.

TBH I don’t think that this is what a newcomer will struggle with the most when she tries to learn the language. I actually find that these conventions are quite nice to orient yourself in the syntactic constructs of the code (e.g. am I accessing a record or a module ?).

I find the obsession some people have that OCaml’s syntax and conventions should absolutely be like everything else out there a bit ridiculous (if such an eveything else even exists…). The reason why we have different programming languages is precisely because they are… different. For example I would never give up OCaml’s terse ML-like syntax for a noisy JavaScript-like notation.

2 Likes