Capitalized_underscore vs CamelCase

Look at almost any file in byterun, or any C file in asmrun. The convention is used for #defines, but since there are a TON of #defines, you end up having it all over the C codebase.

I’m not sure it’s a bad convention – it ends up being a lot clearer than ALL_CAPS. It’s just different, and was jarring to me initially. There’s also a mix of ALL_CAPS and Camel_snake being used for #defines, making it unclear which convention should be used.

You can’t just apply such a modular reasoning here, as this two definitely interfere with each other.

You are right, but using something different and unique is not justified unless it provides some value. Note also that Haskell (being even more “different” than OCaml) uses pretty standard convention for identifier’s style.

I don’t see how they interfere, snake case tells you to separate words by underscores it doesn’t really talk about capitalization. Even the wikipedia page will tell you that the first letter can be upper cased.

which in this case I have hinted at.

However do note that you can not always justify difference through value, sometimes things are simply different for historical reasons.

Look at almost any file in byterun, or any C file in asmrun.

Pretty sure that is entirely unrelated to the convention for module names since the compiler doesn’t use that convention for module names. Also since most people use all caps snake case for macros in C it is not a large change (and also a clear improvement).

Worrying about these kind of trivial entry barriers is basically pointless. If all the of time people spent discussing this kind of thing was instead spent helping to build and maintain the OCaml ecosystem then OCaml would already be much easier to use for beginners.

4 Likes