Author Topic: The rationale for case-sensitivity  (Read 1354 times)

anta40

  • Member
  • ***
  • Posts: 293
The rationale for case-sensitivity
« on: November 21, 2013, 11:12:54 PM »
Most programming language nowadays like Java, Python, Ruby etc are case-sensitive.
Probably because they are implemented in/influenced by C/C++.
So why do C/C++ do this? Probably because UNIX itself is case-sensitive.  :dazzled:

But older languages like Pascal and Basic don't exhibit this behaviour.
I once spent several hours debugging a Java program, only to find out that the variable
NewVar instead of newVar was updated.

Not that obvious, right? Ocasionally this case-sentivity thing bites my leg and I wish this behaviour
can be enabled/disabled (like MASM's option casemap or VB 6's option compare text).

Now I wonder what did those language designers had in mind when
they agreed to put case-sensitivity as a rule...

jj2007

  • Member
  • *****
  • Posts: 7548
  • Assembler is fun ;-)
    • MasmBasic
Re: The rationale for case-sensitivity
« Reply #1 on: November 22, 2013, 12:17:57 AM »
Sometimes it simply looks better...

But it's not limited to C/C++; for example, GfaBasic (1987 or so) keeps the setting you first typed, e.g. MyVar=1, and whenever you type myvar or MYVar or MyvaR, the editor simply reverts it to MyVar. In addition, if you try to use myvar$="Hello", it asks you if you want to create a new variable; which is a good thingTM if you have a long source and a tendency to mistype variable names :icon_mrgreen:

In contrast, Visual Basic keeps the setting you last typed, which is an exceptionally stupid behaviour.

In Assembler, ML or JWasm will inform you that you tried to create a new variable...


Gunther

  • Member
  • *****
  • Posts: 3515
  • Forgive your enemies, but never forget their names
Re: The rationale for case-sensitivity
« Reply #2 on: November 22, 2013, 12:20:16 AM »
Hi anta40,

Now I wonder what did those language designers had in mind when
they agreed to put case-sensitivity as a rule...

I fear that they have thought nothing of it. It's a simple C copy.

Gunther
Get your facts first, and then you can distort them.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 4811
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: The rationale for case-sensitivity
« Reply #3 on: November 24, 2013, 03:02:26 AM »
Its both simpler AND has an extra 26 characters (in English).
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

herge

  • Member
  • ***
  • Posts: 480
Re: The rationale for case-sensitivity
« Reply #4 on: November 27, 2013, 12:25:38 AM »

 Hi *.*:

 In the beginning we only Upper CASE i e A to Z.
 Lower case came next. Ir's only a pain in the butt with
 passwords and you have the CAP lock on by mistake
 when you type your lowercase password which you
 can't see. You usually see ******.
Regards herge
Read "Slow Death by Rubber Duck"
for chemical Laughs.