Why are many regions case sensitive?

Why are many regions case sensitive?

Is it just a matter of inheritance? C ++ is case sensitive because C is Java is case sensitive because C ++ is etc? Or is there a more pragmatic reason?

+43
design case-sensitive
Feb 02 '09 at 13:30
source share
31 answers
  • one
  • 2

Unix

Unix is ​​case sensitive, and so many programming languages ​​developed for use on Unix are case sensitive.

Computers do not forgive - an uppercase character is not the same as a lowercase character, they are completely different. And back when processing cycles, RAM, etc. It was expensive, it was not visible that it was worth it to make compilers and computers "forgive", people just tried to make everything work.

Note that case insensitivity really didn't become anything useful until things like Visual Basic appeared — once companies started investing in the concept that getting masses for a program was a good thing for their bottom line (i.e. Microsoft makes more money if there are more programs on Windows), languages ​​have become friendlier and more forgiving.

+58
Feb 02 '09 at 15:19
source share
— -

I do not think that you will get a better answer than "because the author of this language believed that it was better." Personally, I think they are right. I would really like to find these lines in the same source file (and refer to the same object + method) ...

SomeObject.SomeMethod(); ... SOMEOBJECT.SOMEMETHOD(); ... someObject.someMethod(); ... sOmEoBjEcT.sOmEmEtHoD(); 

I don’t think anyone would be happy to see this ...

+66
Feb 02 '09 at 13:34
source share

Interestingly, English is also case sensitive. (I suspect this is true for most natural languages, but this may not be all true.)

There is a big difference (where I live, at least not far from Reading) between:

I like to read.

and

I like reading.

Likewise, although many people earn money incorrectly, and you can usually understand what is meant, this does not mean that such a letter is considered correct. Incidentally, I pretend that the whole point is that I understand everything correctly. I do not know if this part of the inheritance is case-sensitive of a programming language, but I suspect it might be.

One of the distinctive advantages of case sensitivity for programming languages ​​is that text also becomes culturally insensitive. This is bad enough to sometimes tell the compiler which text encoding is used for the source file - to indicate which culture in it will be even worse :(

+35
Feb 02 '09 at 13:40
source share

This is actually extremely practical for both the developer and the language syntax specification: the lower / upper case distinction adds a lot of expressiveness to the naming of identifiers.

In terms of language syntax, you can force certain identifiers to start in lower or upper case (for example, the name of a Java class). This simplifies the parsing and, therefore, helps to keep the syntax clean.

From the point of view of the developer, this allows you to use a huge number of convenient encoding rules, making your code more understandable and understandable.

+29
Feb 02 '09 at 13:35
source share

My guess would be that case sensitivity increases the namespace. Good trick like

 MyClass myClass; 

it would be impossible with a case-insensitive compiler.

+25
Feb 02 '09 at 13:35
source share

Flag addition is simple in English (and for all characters <128). German sz or "sharp s" (ß) does not have an uppercase option encoded in ISO 8859-1. He only got one from Unicode after a decade of discussion (and now all fonts need to be updated ...). Kanji and Hiragana (Japanese alphabets) do not even know lowercase letters.

To avoid this mess, even at this Unicode age, it is not practical to allow code folding and Unicode identifiers.

+23
Feb 02 '09 at 13:43
source share

Back when parsing and compiling were really expensive, and it would have taken all night to make it profitable for the compiler if he didn't have to worry about the case.

Once identifiers came into existence that were unique only in their case, it was very difficult to go back. Many developers liked this, and there seems to be little desire to cancel it.

+16
Feb 02 '09 at 13:35
source share

ExpertSexChange

I believe this is a Stack Overflow competitor where you have to pay for answers. Hmm ... case insensitive, the meaning of the site name is ambiguous.

This is a good reason that languages ​​are case sensitive. Less ambiguity! Ambiguity for programmers is considered yucky.

+13
Feb 14 '09 at 19:03
source share

Case sensitivity adds to the readability of the language through naming conventions. You can not write

 Person person = new Person("Bill"); 

if your language is case insensitive because the compiler cannot distinguish between the class name and the variable name.

Also, having Person, person, PersoN, PeRsOn and PERSON, all will be equivalent tokens, will give me a headache. :)

+11
Feb 02 '09 at 13:40
source share

What is the capital form of i ? I (U + 0049) or İ (U + 0130)?

Capitalization depends on the language.

+9
Feb 02 '09 at 15:58
source share

Many (non-programmable) languages ​​(for example, European using the Latin alphabet) are case-sensitive, so it is natural for speakers of these languages ​​to use upper and lower case differences.

The very idea that programming languages ​​are not case sensitive is a historical artifact arising from the limitations of early generation hardware (including teletype machines in front of a computer that used a 5-bit character code).

People who argue about random languages ​​should not distinguish

 IAmNowHere 

from

 IAmNowHere 

(This is a joke!; -)

+8
Feb 02 '09 at 15:13
source share

Because they are as stupid as a box of frogs, precisely for the reasons given for the opposite point of view in this topic (I'm not even going to ask about it. A tree for trees and all that).

When FOOBAR = FooBar = foobar, you can choose your agreement, and other coders can do the same, regardless of whether you share your preferences or not. No confusion.

They also can not get away from the genius of a genius who has a constant, function and variable, all with the same name in the same file, although with different caps. Again, there is no confusion.

You call your WebSite variable, they name their website, and which system gets messy? A difficult trick when scanning.

As for searches, is it really much more processing to convert a name to lowercase before looking for it? Doing your own premature optimization is one thing, expecting it to be from the developer of your language of choice - this is another level of point lack.

... and yet, all of these answers, talking about case sensitivity, reduce confusion. Sigh

+7
Feb 02 '09 at 15:12
source share

How do you scream if you do not have CAPS ?! Ahhh!

You must be expressive. But honestly, of all the people in the world, those who work with programming logic will be the first to insist that differences are indeed differences.

+4
Feb 02 '09 at 13:48
source share

There is also Common Lisp, which is case sensitive, which many people mistakenly think are case insensitive. When you enter (car x) into a Listener, it turns into (car x) for processing. You can define characters with lowercase names, but you need to quote them with something like |lower-case-symbol| . Therefore, input to (car x) or (car x) or (car x) everything works the same way.

(Franz Lisp at one point imagined what they called "modern" capitalization, in which the listener was not going to drop things and the CL keywords were lowercase. I never followed him well enough to find out what happened there.)

+4
Feb 02 '09 at 15:31
source share

Uppercase letters are not a universal concept . Java uses Unicode, so if you want case insensitivity for Java, the value of your program may change depending on which locale it was compiled into.

Most languages ​​do not allow dots or commas (or apostrophes or spaces) to be placed in the middle of integer literals, possibly because it also depends on the language.

+4
02 Feb '09 at 18:31
source share

With the .NET Framework Developer's Guide Capitalization Agreements , Case Sensitivity:

Capitalization guidelines exist solely to facilitate identification of read and recognize. A case cannot be used as a way to avoid name collisions between library elements.

Do not assume that all programming languages ​​are case sensitive. They are not. Names may not differ in each case alone.

+4
Feb 14 '09 at 18:31
source share

Case sensitivity does not really help to match case.

 Foo.Bar foo.Bar fOO.bAR 

In the case of an insensitive language that can be easily corrected by the editor. In the case of a case-sensitive language, this is more complicated as it may be legal. The editor must first ckeck if foo.Bar and fOO.bAR exist, and must also guess that you typed the wrong case, and do not forget to declare a variable (since Foo is different from fOO).

+3
Feb 02 '09 at 14:09
source share

Many people said that it would be bad if several forms of capitalization referred to the same thing, for example:

 person perSoN PERSON 

Which would be very bad if they all referred to different objects in the code. If you have the person, perSoN and PERSON variables all refer to different things, you have a problem.

+2
Feb 02 '09 at 14:02
source share

Every example I saw supports case sensitivity, based on the desire to write poor, non-indexing code. for example, the date and myDate arguments are both bad practices and bad practices. It’s good practice to call it what it really is: birthDate, hireDate, invoiceDate, whatever. And who in their right mind would like to write code like:

 Public Class Person Public Shared ReadOnly PERSON As Person End Class Public Class Employee Public person As Person = person.PERSON End Class 

Surprisingly, this is a perfectly valid case in the sensitive VB.Net code. The idea that case sensitivity makes you even more rude to disobey good programming practice is an argument against it, not for it.

+2
Dec 23 '09 at 17:19
source share

Since many people find employeeSocailSecurityNumber as readable as employee_social_security_number, and it is shorter.

+1
02 Feb '09 at 14:16
source share

I think case sensitive language understands people writing bad code.

 Const SHOESIZE = 9 Class ShoeSize ShoeSize.shoesize = SHOESIZE call shoeSize(ShoeSize); function shoeSize(SHOEsize) { int ShoeSIZE = 10 return ShoeSize } 

Duh. Could you come up with a better variable name than "ShoeSize" for different purposes? There are a billion different words you could use, but did you decide to just use ShoeSize instead?

+1
Apr 22 '09 at 7:28
source share

And you could (stupidly) just use single letters ("a" and "b" and "c") for all classes, variables, functions and methods.

But WHY would you like to?

Use names that make sense , not:

 function a(a) { int a = aa; return a } 
+1
Apr 24 '09 at 4:51
source share

There is another reason that languages ​​are case sensitive. Identifiers can be stored in a hash table, and hash tables depend on hash functions that will give different hashes for different cases. And it may not be convenient to convert all identifiers to all upper or all lower ones before starting them through a hash function. I ran into this problem when I was writing my own compiler. It is much easier (lazier) to declare my language case sensitive.

+1
Mar 02 '14 at 12:34
source share

I read this whole topic. I must believe that those who report having found value in the case of sensitivity are never programmed in a true high-level language (which by definition is case insensitive). K & R assumes that C is average. After programming in Pascal, Delphi, Lazarus, ADA, etc., you will learn that very readable code is easy to write and runs quickly, without focusing on complex case-sensitive constructs. In the end, readability is the first and last word on this subject. The code is written for a person, not for a computer. No problem debugging with case insensitive code. When a person moves to a mid-level level, you may find that there are no benefits to case sensitivity. However, a significant amount of hours spent debugging caused problems. Especially when packaging modules from different encoders. It also appears that a large number of respondents do not understand what is meant by case sensitivity. They are affected only by the az characters. This is a sequential subset of ASCII characters. Three or four bytes of machine code make the compiler indifferent to the case in this range of characters. It does not change the sub-bar, numbers or anything else. The points about other languages ​​and character sets simply do not apply to this discussion. The compiler or breaker will be encoded to temporarily convert or not to convert the character for analysis during compilation based on ASCII or not.

I am shocked by new languages, such as Python, that made a repetition of the error made by K & R. Yes, they saved half a dozen bytes in an environment where the total RAM for the compiler code, source and object was 1000 bytes. What happened then. Now memory is not a problem. Now, for no good reason, even fallback words in Python are case sensitive! I do not think that I will need to use "For" of "Print" as the name of a variable or function. But this possibility was saved due to the expensive time spent using a breaker on the exact case of each identifier. I think a bad deal.

The closest thing I've read so far in support of case sensitivity is the comments on Hashing. But these rare encoding events, which can be handled with particular attention to detail, do not seem to deserve the aimless study that an encoder should use to write case-sensitive code. Two views on the problem. One encourages poor coding, sets traps in code, and requires extra attention to distract from larger concepts. The other does not have a single side, it worked flawlessly in high-level languages ​​and allows flexibility if it does not hurt. It seems to me that another case of VHS outperforms BETA. Here are just my two cents.

+1
Dec 08 '15 at 22:34
source share

Learning is always simpler with an example, so here it is:

C # (case sensitive, but used with VB.NET, which is case insensitive):

 CONSTANT_NAME IInterfaceName // Uses I prefix in all case sensitive and insensitive languages ClassName // Readable in both case sensitive and insensitive languages _classMember // sometimes m_classMember or just classMember DoSomething(someParam) // Method with action name, params can be _someParam PropertyName // Same style in case sensitive and insensitive languages localVariable // Never using prefix 

Java and JS use a style similar to C #, but methods / functions / events are declared as doSomething, onEvent variables.

ObjectPascal (Delphi and Lazarus / FPC are not case sensitive such as ADA and VB.NET)

 CConstantName // One can use Def or no prefix, not a standard IInterfaceName TClassName // Non-atomic types/classes have T prefix eg TStructRecordName PSomePointer // Pointers have types, safer low level stuff FClassFieldMember // F means Field member similar to m DoSomething(Parameter) // Older code uses prefix A for parameters instead PropertyName LLocalVariable // Older code uses prefix for parameters not local vars 

Using only OneCase and prefixes for each type makes sense in all languages. Even languages ​​that run without prefixes have newer constructs, such as interfaces, that do not rely on chance, but use a prefix instead.

So it really doesn’t matter if the language is case sensitive or not. Newer concepts have been added to case-sensitive languages ​​that were too confusing to be expressed in only one case and required using a prefix.

Since case-sensitive languages ​​have begun to use prefixes, it is prudent to stop using the case with the same identifier name someIdentifier SomeIdentifier SOME_IDENTIFIER, ISomeIdentifier and just use prefixes where that makes sense.

Consider this problem: Do you have a member of a class called something, a method / function parameter called something, and a local variable called something, which case convention can be used to easily distinguish them? Isn't it easier to just use most ConsistentCaseStyle everywhere and add a prefix?

Fans of case-insensitive languages ​​care about the quality of the code, they just want the same style. Sometimes they agree that one library is poorly written and uses a strict style, while a library may not have a style or bad code.

Both case-sensitive and case-insensitive languages ​​require strict discipline, it makes sense to have only one style all over the world. It would be better if we had a language that used only StrictCase, one style everywhere and prefixes.

There is a lot of bad C code, case sensitivity does not make it readable, and there is nothing you can do about it. In a case-insensitive language, you can provide a good style in your code without overwriting the library. In the StrictCase language, which does not yet exist, all the code will have decent quality :)

+1
Apr 27 '16 at 21:40
source share

It seems that people basically agree that case sensitivity is important, and I agree.

However, it can be annoying when you need to enter something in the right case, so I believe that the IDE should allow you to enter the wrong case, but if you click on the auto-complete shortcut, it should make case insensitive. It gives us the best of both worlds.

0
Feb 02 '09 at 17:23
source share

MyClass myClass; it would be impossible with a case-insensitive compiler.

Or you can be smart and actually use 2 different words ... to better show what you are actually trying to do, for example:

MyClass myCarDesign;

Duh.

0
Apr 22 '09 at 7:30
source share

Person , - , PERSON - . , , .

, , , , ? , , ?

, Robert@widgets.com, robert@widgets.com ROBERT@widgets.com, ?

. , , .

, . , , , , ,

- , , , ? ?

, "MyClass myClass" - , ? , .

, , , .

For example.

NewCustomer

CorporateCustomer

, , !

0
04 . '14 14:45
source share

, ? , . . , , , - " ", " C " " C ustomer"! - " ", - , , , - . , - COBOL, -.

0
15 . '15 10:02
source share

.

, . It means that:

  • " TextureImage ", " TextureImage ", IDE . , , .

  • Java ; " MyClass myClass ". IDE .

, , " o " " o " . :

  • " sOmEoNe wIlL tYpE cOdE lIkE tHiS "; = > - , . , - , , , .

  • " !"; = > 95% . , ( ). , , , - 21 ; - , , google, - .

  • ", , , !"; = > , , .

, , .

0
15 . '17 14:05
source share
  • one
  • 2



All Articles