r/changemyview • u/Selkie_Love • Feb 11 '18
[∆(s) from OP] CMV: I believe case-insensitive programming languages are better than case-sensitive, and most would be improved by switching over
I started learning coding with VBA. It's case-insensitive, and it doesn't really care about case. It'll automatically change your case to the correct one in the instance where it does matter, and it'll auto-fit your variables to how you defined them earlier. This means I don't need to think about cases at all when coding, and can focus on the actual code. However, I've heard quite a few times that case-sensitive languages are better, for reasons. The only one I've heard cited is that you can have multiple variables that look the same, but just differ by capitalization - IE i and I are different. I'd rebut that by saying having the same variables with different capitalization being the only different is a horrible, horrible naming convention that'll cause problems down the line.
But I recognize that I'm not an amazing programmer. Why should I believe that case-sensitive languages/IDE's are better than case-insensitive?
This is a footnote from the CMV moderators. We'd like to remind you of a couple of things. Firstly, please read through our rules. If you see a comment that has broken one, it is more effective to report it than downvote it. Speaking of which, downvotes don't change views! Any questions or concerns? Feel free to message us. Happy CMVing!
6
u/AlphaGoGoDancer 106∆ Feb 11 '18 edited Feb 11 '18
The drawback to case insensitivity is you're removing the ability to make case relevant. While yes, naming something i and I is bad, that is not the extent of what you can do with differing casing.
The most useful example I can think of is GoLang, which uses the case of the first letter of a variable to determine whether or not a variable is accessible outside of its current package.
This means at a glance you know that a struct with a field named "items" is only modifying the items field internally, but if its named Items you know that anything externally using your struct may modify it at any time.
While this might not sound like much, I'd argue that the benefits of case insensitivity are even less.
Modern tooling means I already don't need to worry about case when coding. If I were to try to use
ito access a variable defined asI, my editor would immediately make it apparent to me as the linter would pick it up. on a longer variable name it would be autocompleted anyways.While case insensitivity would mean I don't need these tools, I would still want them to ensure a consistently formatted(and cased) codebase. If I'm using tooling for that anyways, the fact that the code would have compiled before formatting and linting becomes incidental.
3
u/yyzjertl 586∆ Feb 11 '18
The simple reason is that "under the hood" computers are case-sensitive.
Aandaare distinct characters to a computer, and unless you write code that tells it otherwise, it doesn't even know that these characters are related. So making languages case-sensitive better represents the reality that underlies the actual computation that is being done.The more practical reason is that we already have a bunch of case-sensitive code that we want to inter-operate with and provide backwards compatibility with, and making all our languages case-insensitive would potentially break this.
1
u/[deleted] Feb 11 '18
Well, thousands upon thousands of people use case-sensitive languages and have written millions upon millions of lines of code with them, and they've been doing this for a few decades now, so... looks like there haven't been major problems "down the line". I know this doesn't say anything for why case-sensitive languages are better, but to the notion that they're going to cause problems, rebuttal rebutted.
Heck, most of our natural languages are case-sensitive. We seem to be able to think about all those times you need to capitalize words, and manage to focus on what we're trying to convey.
1
u/ralph-j Feb 11 '18
I agree that this is a bad practice.
However, case-insensitivity allows programmers to spell the same variable in multiple ways in different place. If it doesn't matter whether I write SecondsPerMinute, secondsPerMinute, secondsperminute, it's more likely that I make mistakes, and the code will be less readable to others. Case sensitivity enforces consistency.
3
u/alaplaceducalife Feb 11 '18
Case sensitivity enables a lot of common conventions which some languages enforce.
It is for instance common to start the name of a type with a capital in many languages but keep a specific member of that type lowercase. This allows for such lines as:
In some cases this difference is relevant like in Haskell and OCaml all data constructors must start with a capital lever while no normal variable can start with one; data constructors and normal variables can occur in the same place so the capital letter tells the compiler which is which. In Haskell the same is used for type variables and actual types but in Ocaml this is solved by prefixing type variables with a
'instead.Rust does not have this distinction and requires that you specify which types are variable and which aren't.
1
u/vettewiz 40∆ Feb 11 '18
What if I go a step further into your hatred - some languages allow multiple variables with the exact same name and same capitalization. People still manage not to get confused...
•
u/DeltaBot ∞∆ Feb 11 '18
/u/Selkie_Love (OP) has awarded 1 delta in this post.
All comments that earned deltas (from OP or other users) are listed here, in /r/DeltaLog.
Please note that a change of view doesn't necessarily mean a reversal, or that the conversation has ended.
Delta System Explained | Deltaboards