Waldek Hebisch wrote:
I belive that capitalization is meaningfull for people.
I don't really. In natural language, capitalization is used as a help in reading (used differently in different languages), but it does not carry meaning itself (e.g., a text written in all-caps still has the same meaning).
That argument is bogus. You can distort text quite a lot and people still may read it correctly.
Sorry, but *that* argument is bogus. All-caps text is not quite the same as distorted text.
In math it is usual to use names differing only in case for different objects.
In math, it's usual to use single letters, perhaps indexed etc., rather than words.
Note also that capitalization have meaning beyond literal meaning of the text -- it helps express emotions, respect or stress something.
Well, I was about to write "these comparisons go too far" before I read this paragraph, but now it's really too much! Emotions in a Pascal program, eh? ;-)
Let's stick to Pascal based arguments, perhaps?
In my experience, variations in capitalization in Pascal code arise mostly in the following cases:
Typos -- good when warned
Less strict used of capitalization (e.g., parts of the code having all-lowercase identifiers) -- also good when warned (if you care about capitalization at all, otherwise turn off the warning anyway).
Different arbitrary choices (e.g. `DOS' (acronym) vs. `Dos' (everyday way)). Still it doesn't really carry meaning.
Short identifiers such as `x' vs. `X'. These names are not actually meaningful anyway.
You forgot:
- NamesConsistingOfMultipleWords (most frequent in my experience)
True. But using different concatenations resulting in the same identifier (such as `FooBar' and `FoobAr' -- I know there are real examples of this, I just don't have them in mind right now) is asking for trouble in a case-insensitive language. In C, you can do this and get away with it. In Pascal, sooner or later, you might use those names in the same scope and get a conflict. So even here, I prefer the current behaviour which warns me as soon as possible and lets me choose another name for one of the things.
- conventions like: globals capitalized, locals lowercase
or agregates capitalized, scalars lowercase
IMHO these are archaic conventions, coming from languages such as C (where there's only one global and one local level, in contrast to Pascal which has arbitrarily many levels, and a local variable of level 1 can behave like a global variable, seen from a routine at level 2, etc.), and assembler (where there's a general difference between aggregates and scalars). So I don't care much for such conventions.
And we should divide programmers into two groups, one that does not care about capitalization and the second that cares. The first group produces lot of meaningless variation, but they are irrelevant for the discussion since they wish no warning. The second group IMHO is much more likely to associate meaning with capitalization.
So do I, yet I prefer to avoid different capitalizations of the same identifier (see above).
So it is natural that different meanings needs different capitalizations. Of course, some persons may wish warning for re-using an identifier with different meaning (or as compromise, a warning when meaning is different enough to require different capitalization :)). But IMHO the main use of `-Widentifier-case' is to ensure that standard (case insensitive) interpretation coincides with case sensitive one.
Which case-sensitive one? It's Pascal code, and Pacal is case-insensitive. If you mean translating Pascal code to C or another case-sensitive language, this may become an issue, but certainly one of the least ones.
- If you use a convention assigning meaning to case, then reader point of view is case-sensitive.
And if this point of view differs too much and may get in conflict with the compiler's point of view (cf. the `FoobAr' example above)?
- When working both with case sensitive and case insensitive languages a programmer may save sanity by treating both as case-preserving.
In this case (which actually applies to me as well), one should use the lowest-common denominator. I.e., never declare `I' and use `i' (would break in C), but also never declare an `I' and another `i' (would break in Pascal, perhaps even in non-obvious ways (read: hard to find bugs), if these declarations "meet" later).
- Many tools are easier to use as case sensitive ones (simple example is global regex search&replace)
My editor (and many of the tools I use) can actually do case-insensitive regex operations, BTW. But that's beside the point, because I do program in a case-sensitive way.
Frank