Yet Another Case Question
sholden at holdenweb.com
Mon Feb 24 04:37:24 CET 2003
"David Mertz, Ph.D." <mertz at gnosis.cx> wrote ...
> Many of the folks who argue for case-sensitivity perceive the negative
> effect as being small or non-existent. Quite likely, most of them are
> towards the visual end of things, and the relative stumbling block of
> finding the correct case for a term is less for them than for me.
Well, in my own case it's so likely I'll mistype something that
case-sensitivity doesn't really add much extra overhead. Of the many typos I
make, case transposition is a very small subset.
> But in all this latest discussion (and in the prior ones about the same
> matter), I do not think I've really seen any explanation of a POSITIVE
> benefit to case-sensitivity (as a language feature). I am quite willing
> to believe there are some... but I just don't know what they are.
Well, the only POSITIVE benefit I can think of it that it's easiest to tell
learners that a variable name must always be written in EXACTLY the same
way. This does lend certainlty to the learning process.
> I'd like to rule out several answers, however. I think some frequent
> remarks are really misleading on this.
> - If a language were case-insensitive, users would use absurdly mixed
> case variables, e.g. "maXImUMCoLumnS". This is just factually
> false--many millions of lines of code in existing case-insensitive
> languages fail to show such a problem.
> - Case-sensitivity allows conventions such as allcaps CONSTANTS. Such
> conventions are indeed good... and are widely used in
> case-insensitive languages as well.
But if the language is case-insensitive, the variable "constant" will
conflict with the constant "CONSTANT".
> - Programmers should learn mental discipline by learning to remember
> casing. There's plenty of learning to go around either way,
> arbitrary games are not any plus.
Case-insensitivity, however, makes it less likely that case-based
conventions will be respected.
> - If names were case-insensitive, string literals would have to be so
> too. With all due respect to my friend Tim Churches, this notion is
> just plain whacked.
Whatever. Cold Fusion with Access, for example, does implement
case-insensitive compatrison with the contents of database fields. And let's
not even start to think about VBScript's case-insensitivity with respect to
> - Case-eating nano-viruses will invade our source code.
> - People naturally learn case as part of spelling. Overwhelmingly,
> this claim is false; far more ofte in ordinary usage, case varies in
> ways that have nothing to do with the referents of terms. Almost
> always, case follows other context, or is just randomly varied. In a
> few borderline situations, case-sensitive names actually are used
> outside of programming languages.
Frankly I'm so tired of seeing ignoramuses using apostrophes to indacte the
plural rather than the possessive, and "its" used where "it's" is
appropriate (and vice versa) that I begin to feel that some discipline is
not a bad thing ... as long as it actually HURTS!
> - The convention about instances and classes: "person = Person()" is
> fairly elegant. I agree. But other conventions are possible too
> that would achieve a similar effect.
Right. We could start all class names with "cls", for example. Didn't some
Hungarian guy suggest this some time ago?
> Yours, David...
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/
Register for PyCon now! http://www.python.org/pycon/reg.html
More information about the Python-list