I know that the distinction between initial-uppercase names and and initial-lowercase is a longstanding part of the language, and that normal values cannot begin with a capital letter; initial capitals are reserved for other functions, such as module and type constructor names. I understand that allowing violations of this rule could make reading others’ code confusing.
Still, I keep finding that the capitalization rule interferes with clarity of my code when I am trying to model a domain in which capitals are normally used as variable names.
Is there is any optional language extension that is available, or that has been proposed, that would allow uppercase value names?
Has there been any discussion of allowing initial-uppercase value names in Reason?
I know that this is a somewhat perverse idea given that capitalization is a part of OCaml’s design.
Use case examples:
In population genetics, population size is almost always represented as a capital “N”. This convention is so pervasive that often you don’t even have to mention that N represents population size; the letter itself is clear enough. Implementing a population genetical model in OCaml means using some other name for population size. Lowercase n is confusing. Something like
pop_sizeworks, of course, but it takes up unnecessary space, given that
Nwould be entirely clear.
I’m implementing models described in a book in which capital letters represent matrices, and lowercase letters represent vectors or numbers. Some models include, for example, both P, which is a matrix, and p, which is one of its rows. This sort of convention for linear algebra is very common, of course.
Obviously one can work around the difficulties, and I do, but the meaning is less clear (or the code is more verbose) without uppercase single letter variables.