Waldek Hebisch wrote:
Frank Heckenbach wrote:
Waldek Hebisch wrote:
the spelling. It is natural to take scope rules into account when warning about capitalization, but that requires extra work.
It may be natural for some. I actually prefer it the way it is, i.e. I prefer to use the same spelling (capitalization) throughout. So if you or someone else implements the other way (which is indeed more work), it should at least be optional.
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. But in all caps text one can easily misread proper name and take it as ordinary word. If you take a single word in isolation, then your chance to get correct meaning is significantly lower with case-folded word. In math it is usual to use names differing only in case for different objects.
Note also that capitalization have meaning beyond literal meaning of the text -- it helps express emotions, respect or stress something. Programming languages have much less redundancy then natural language so capitalization becomes more valuable.
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)
- conventions like: globals capitalized, locals lowercase or agregates capitalized, scalars lowercase
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 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.
1) If you use a convention assigning meaning to case, then reader point of view is case-sensitive.
2) When working both with case sensitive and case insensitive languages a programmer may save sanity by treating both as case-preserving.
3) Many tools are easier to use as case sensitive ones (simple example is global regex search&replace)