Thread overview | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 25, 2002 Can we discuss case-sensitivity? | ||||
---|---|---|---|---|
| ||||
D is case-sensitive because C is, right? Is that a good enough reason? I've read a few flame-fests on comp.lang.c that, um, "discussed" this issue, and I've never seen any authoritative word stating why case-sensitivity is better - and I have my own catalog of personal experiences saying why it's worse. Why can't D be case-insensitive? -- Richard Krehbiel, Arlington, VA, USA rich@kastle.com (work) or krehbiel3@comcast.net (personal) |
February 25, 2002 Re: Can we discuss case-sensitivity? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Richard Krehbiel | Richard Krehbiel wrote: > D is case-sensitive because C is, right? Is that a good enough reason? > > I've read a few flame-fests on comp.lang.c that, um, "discussed" this issue, and I've never seen any authoritative word stating why case-sensitivity is better - and I have my own catalog of personal experiences saying why it's worse. > > Why can't D be case-insensitive? I would argue in favor of case senisitivity. However, I do not do so because I want to have multiple variables with different case patterns. Instead, I think that case sensitivity is a useful feature that helps enforce coding conventions. IMHO, code were the case patterns are consistent throughout improves readability. Allowing case INsensitivity would make it easier for programmers to (accidentally or intentionally) mix up case patterns. -- The Villagers are Online! villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ] |
February 25, 2002 Re: Can we discuss case-sensitivity? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Richard Krehbiel | "Richard Krehbiel" <rich@kastle.com> wrote in message news:a5druk$1nic$1@digitaldaemon.com... > D is case-sensitive because C is, right? Is that a good enough reason? > > I've read a few flame-fests on comp.lang.c that, um, "discussed" this issue, > and I've never seen any authoritative word stating why case-sensitivity is better - and I have my own catalog of personal experiences saying why it's worse. > > Why can't D be case-insensitive? Why not? =) Actually, I know only one argument for case-sensitivity: this way, you may be sure that everybody spells that function (class, enum, variable...) name the same. This is not so in Pascal, where for example most people call types Integer, Boolean, Char etc, while others (me) prefer integer, boolean, char - and others might think that using INTEGER is a good idea. Such a code can be damn hard to read. |
February 25, 2002 Re: Can we discuss case-sensitivity? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Richard Krehbiel | "Richard Krehbiel" <rich@kastle.com> wrote in message news:a5druk$1nic$1@digitaldaemon.com... > D is case-sensitive because C is, right? Is that a good enough reason? > > I've read a few flame-fests on comp.lang.c that, um, "discussed" this issue, > and I've never seen any authoritative word stating why case-sensitivity is better - and I have my own catalog of personal experiences saying why it's worse. > > Why can't D be case-insensitive? > > -- > Richard Krehbiel, Arlington, VA, USA > rich@kastle.com (work) or krehbiel3@comcast.net (personal) > > Interesting issue indeed... Here are some arguments, pre as well as con, about case sensitivity: Case sensitive code is A Good Thing: 1) Because it will avoid inconsistincies in code when one programmer writes printf, while another writes Printf. 2) Because it allows for two identifiers with names that differ only in case, like a constant or type and a variable. HANDLE handle; 3) Because it requires one less compilation step, hence making it faster to compile. Case sensitive code is A Bad Thing: 1) Because it will force inconsistincies in code written by the same programmer, when different other programmers chose different uses of case for libraries: printf, CreateWindowEx 2) Because it allows for two identifiers with names that differ only in case, like a constant or type and a variable. HANDLE handle; 3) Because to humans, words don't significantly change their meaning, just because their case does. They might to programmers though... :) Interestingly enough argument 2) can be used to attack as well as support case sensitivity. In the end I think it comes down to personal taste. Both methods have their merits. Since a lot of D code has already been written that might be dependant of case sensitivity, I think changing it is not worth the effort. Purely looking at it from a conceptual point of view though, I support case insensitive code, like Pascal. -- Stijn OddesE_XYZ@hotmail.com http://OddesE.cjb.net __________________________________________ Remove _XYZ from my address when replying by mail |
February 25, 2002 Re: Can we discuss case-sensitivity? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russ Lewis | "Russ Lewis" <spamhole-2001-07-16@deming-os.org> wrote in message news:3C7A73A5.C4051D10@deming-os.org... > Richard Krehbiel wrote: > > > D is case-sensitive because C is, right? Is that a good enough reason? > > > > I've read a few flame-fests on comp.lang.c that, um, "discussed" this issue, > > and I've never seen any authoritative word stating why case-sensitivity is > > better - and I have my own catalog of personal experiences saying why it's > > worse. > > > > Why can't D be case-insensitive? > > I would argue in favor of case senisitivity. > > However, I do not do so because I want to have multiple variables with different > case patterns. I don't think case-sensitivity gives you anything else. > Instead, I think that case sensitivity is a useful feature that > helps enforce coding conventions. IMHO, code were the case patterns are > consistent throughout improves readability. Allowing case INsensitivity would > make it easier for programmers to (accidentally or intentionally) mix up case > patterns. I'm thinking (perhaps wrongly) that you mean case-sensitivity enforces coding conventions that specify how to compose identifiers and in which case; for example, the Java conventions that say, type names begin with uppercase like ClassName, methods begin with lower case like methodName. Now, I immediately see an issue with that convention, specifically that you only have a single bit to distinguish two types of pattern. What if you need four, or six different patterns? You have to add some other identifiers. An associate of mine likes to tack the variable's scope onto identifiers; "l_var" is a local var, "i_var" is an instance var, "g_var" is global, "a_var" is a function argument, etc. He does this so he knows where to look for the object's definition. It's a powerful convention for his language (Powerbuilder; I don't need it because I can right-click and say "go to definition" in Visual C). Indeed, a case-sensitive language needs identifier case conventions, but if you didn't have a case-sensitive language, you'd use conventions such that identifier case doesn't matter. BTW, A case-insensitive language can *support* any such shop conventions as well, it just doesn't enforce them; and, before thinking how bad this is, I've seen coding-conventions documents that make rules for indentation and whitespace, even though few compilers have any means to enforce these. -- Richard Krehbiel, Arlington, VA, USA rich@kastle.com (work) or krehbiel3@comcast.net (personal) |
February 25, 2002 Re: Can we discuss case-sensitivity? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | In C I dislike using the C standard library functions (even C++ STL stuff annoys me) since it doesn't use my preferred capitalization style, which coincidentally is the same as Java uses. (I don't use Java) I just don't see why case is such a big deal, I'd really prefer that case not matter at all. If someone writes INTEGER all over I can always global-search-and-replace that crap. The *only* reason I can think of is it allows the symbol lookups in the compiler to be a teeny bit faster, Pascal parsers are a bit more complicated due to this case insensitivity. Sean "Pavel Minayev" <evilone@omen.ru> wrote in message news:a5dt5k$1o4u$1@digitaldaemon.com... > "Richard Krehbiel" <rich@kastle.com> wrote in message news:a5druk$1nic$1@digitaldaemon.com... > > > D is case-sensitive because C is, right? Is that a good enough reason? > > > > I've read a few flame-fests on comp.lang.c that, um, "discussed" this > issue, > > and I've never seen any authoritative word stating why case-sensitivity is > > better - and I have my own catalog of personal experiences saying why it's > > worse. > > > > Why can't D be case-insensitive? > > Why not? =) > > Actually, I know only one argument for case-sensitivity: this way, you may be sure that everybody spells that function (class, enum, variable...) name the same. This is not so in Pascal, where for example most people call types Integer, Boolean, Char etc, while others (me) prefer integer, boolean, char - and others might think that using INTEGER is a good idea. Such a code can be damn hard to read. |
February 26, 2002 Re: Can we discuss case-sensitivity? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Richard Krehbiel | On Mon, 25 Feb 2002 12:23:08 -0500, "Richard Krehbiel" <rich@kastle.com> wrote:
> D is case-sensitive because C is, right? Is that a good enough reason?
>
> I've read a few flame-fests on comp.lang.c that, um, "discussed" this issue, and I've never seen any authoritative word stating why case-sensitivity is better - and I have my own catalog of personal experiences saying why it's worse.
>
> Why can't D be case-insensitive?
>
Bertrand Meyer:
Letter case is not significant in our notation, as it is too dangerous to let
two almost identical identifiers denote different things."
Me:
Letter case is significant in my notation, as it is too dangerous to let
two different identifiers denote the same thing.
Case-uniqueness is a third possibility: Case is significant, but identifiers can not be distinguished by case alone. Having defined 'Foo', the definition or use of 'foo' would be prohibited.
Karl Bochert
|
February 26, 2002 Re: Can we discuss case-sensitivity? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Karl Bochert | Karl Bochert wrote:
> Case-uniqueness is a third possibility: Case is significant, but identifiers
> can not be distinguished by case alone. Having defined 'Foo', the
> definition or use of 'foo' would be prohibited.
>
I could accept that, and would prefer it to case-insensitivity.
It would lead to writing things like:
HANDLE handle_;
or
HANDLE myHandle;
where one might want to write
HANDLE handle;
-RB
|
February 26, 2002 Re: Can we discuss case-sensitivity? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russell Borogove | Russell Borogove wrote:
> Karl Bochert wrote:
>
>> Case-uniqueness is a third possibility: Case is significant, but identifiers
>> can not be distinguished by case alone. Having defined 'Foo', the
>> definition or use of 'foo' would be prohibited.
>>
>
> I could accept that, and would prefer it to case-insensitivity.
> It would lead to writing things like:
>
> HANDLE handle_;
>
> or
>
> HANDLE myHandle;
>
> where one might want to write
>
> HANDLE handle;
I like that idea! I've always hated case-sensitivity because of the way people abuse it with things like "Handle handle;", but have never minded being forced to use consistent capitalization myself (I think it's good to have at least certain amount of discipline when writing code)
This would give you the best of both worlds, ruling out both kinds of laziness: using confusing names, and just plain sloppy writing.
Barry
|
February 26, 2002 Re: Can we discuss case-sensitivity? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Karl Bochert | "Karl Bochert" <kbochert@ix.netcom.com> wrote in message news:1103_1014692646@bose... > On Mon, 25 Feb 2002 12:23:08 -0500, "Richard Krehbiel" <rich@kastle.com> wrote: > > D is case-sensitive because C is, right? Is that a good enough reason? > > > > I've read a few flame-fests on comp.lang.c that, um, "discussed" this issue, > > and I've never seen any authoritative word stating why case-sensitivity is > > better - and I have my own catalog of personal experiences saying why it's > > worse. > > > > Why can't D be case-insensitive? > > > Bertrand Meyer: > Letter case is not significant in our notation, as it is too dangerous to let > two almost identical identifiers denote different things." > > Me: > Letter case is significant in my notation, as it is too dangerous to let > two different identifiers denote the same thing. Um - I'm having trouble making sense of that. It looks like you just spoke out against type aliases (two different names for the same thing). > > Case-uniqueness is a third possibility: Case is significant, but identifiers > can not be distinguished by case alone. Having defined 'Foo', the definition or use of 'foo' would be prohibited. Um - okay, now I'm further puzzled. After having defined "Foo", attempting to define "foo" is the same as attempting to redefine "Foo". What makes this different from case-insensitivity? |
Copyright © 1999-2021 by the D Language Foundation