Module files, module names, and capitalization

This may be a stupid question, but I don’t seem to be able to see a more detailed answer in the documentation.

Say I would like to create a separately compiled module named FooBar.

However if I some files foobar.ml and foobar.mli, the result of compiling will be a module named Foobar, not FooBar.

Am I correct in thinking there is no obvious way to get around this, and I should accept that I’m stuck with naming the module Foobar?

2 Likes

No you can name your file fooBar.mli. That said the programming guidelines advise you to separate words by underscore and not use camelcase.

Since I don’t want to think too much about these things either while defining or using identifiers I always simply lowercase everything (acronyms included) separate words by underscore and for modules names in code capitalize the first letter as is mandated by the language.

2 Likes

Is inserting a capital into a file name reliable given that many non-Unix operating systems don’t deal very intelligently with case distinctions?

Regardless, though, if the preferred style is to use underscore, I’ll use underscore. (I was going for the moment off of this style guide which suggests CamelCase for module names but snake_case for variables and types.)

(BTW, I have to thank everyone for being so kind. I’ve asked a bunch of questions recently and I’ve gotten nice answers each time. I wish that was the case in every programming language community, but it isn’t. Everyone has been very patient and helpful and it has made my life much easier.)

4 Likes

I think this has been used many times by projects without problems. I don’t think you’ll run into one as long as you don’t try to have both foobar.ml and fooBar.ml (this wouldn’t work on macos’ case insensitive file system).

2 Likes

I believe Windows has similar (and sometimes worse) issues.

Everyone is very functional here :wink: