Search code examples
programming-languageslanguage-featureslanguage-designcase-sensitivecase-insensitive

What is the purpose of case sensitivity in languages?


Possible Duplicates:
Is there any advantage of being a case-sensitive programming language?
Why are many languages case sensitive?

Something I have always wondered, is why are languages designed to be case sensitive?

My pea brain can't fathom any possible reason why it is helpful.

But I'm sure there is one out there. And before anyone says it, having a variable called dog and Dog differentiated by case sensitivity is really really bad practise, right?

Any comments appreciated, along with perhaps any history on the matter! I'm insensitive about case sensitivity generally, but sensitive about sensitivity around case sensitivity so let's keep all answers and comments civil!


Solution

  • It's not necessarily bad practice to have two members which are only differentiated by case, in languages which support it. For example, here's a fairly common bit of C#:

    private readonly string name;
    public string Name { get { return name; } }
    

    Personally I'm quite happy with case sensitivity - particularly as it allows code like the above, where the member variable and property follow conventions anyway, avoiding confusion.

    Note that case-sensitivity has a culture aspect too... not all cultures will deem the same characters to be equivalent...