7 ms·
Sounds sensible. Case sensitivity makes life harder for beginners and the advantages are minimal (would you really want to have two different variables called V
by lmm 11y ago
Sounds sensible. Case sensitivity makes life harder for beginners and the advantages are minimal (would you really want to have two different variables called VariableName and variable_name in scope?). There are plenty of potential pitfalls (e.g. code that only compiles in Turkey), but the principle is a great idea.
- scardine 11y agoIn Python there is a convention for naming classes with `CamelCase` and instances with `snake_case`. It works very well, you can always tell if you are dealing with a class or an instance. Personally I believe code is harder to read than to write, so I favor languages that are easier to read.
- lmm 11y agoIf such a convention applied consistently that would be great. But my Python experience is that it isn't, and an inconsistent convention is worse than useless. If such a distinction is to be meaningful then IMO the language itself needs to enforce it.
- scardine 11y agoI agree, it should be mandatory - one of the things I like about Nim is static typing. Oddly enough, the "we are all consenting adults" attitude works in Python. Most patterns and interfaces are by convention instead of being enforced. People don't abuse Pythons permissive nature very often, and when they do they are frowned upon by the community. I think such deviations are easier to spot in Python compared to other languages, don't really know why.
- piva00 11y agoExactly why I like Go's conventions for public/private, when I was younger and less experienced I always thought that it was great to have freedom to name things however I wanted but now I can't find a good argument against opinionated and enforced conventions for naming. I actually would appreciate if someone could provide me one.
- federico3 11y agoKeep in mind that Nim is statically typed and the typing prevents ambiguity: foo.say_hi() and SayHi() are not the same.
- JadeNB 11y ago> Case sensitivity makes life harder for beginners I think that I disagree. In general (not all the time, but often), things that look different should be different; allowing them to be treated the same is offering beginners a short-time advantage, while preventing them from making, or even understanding, distinctions that they may want to make in the long term. Imagine, for example, a car where both pedals behave the same, and where the actual function is determined by smart traffic-analysis sensors in the car. It would certainly be easier for beginners, but I imagine that it would produce worse drivers; for example, you couldn't drive anyone else's car. > would you really want to have two different variables called VariableName and variable_name in scope? Yes, sometimes! (Not that particular example, but there have definitely been cases when I have wanted variables with the same letters in their names but different capitalisations.)
- lmm 11y ago> In general (not all the time, but often), things that look different should be different Case-sensitivity is the opposite though: it's making two things that look the same be different. I could maybe support a rule (or even just a linter) that each variable had to be written in a consistent case throughout the project, but two different variables that differ only in case should definitely be disallowed, IMO. > It would certainly be easier for beginners, but I imagine that it would produce worse drivers; for example, you couldn't drive anyone else's car. I don't think people buy their cars on the basis of how easy they make it to drive someone else's car, and nor should they.
- wtetzner 11y ago> Case-sensitivity is the opposite though: it's making two things that look the same be different. No it isn't. fooBar and foo_bar have the same words in them, but they look very different.
- randallsquared 11y agoWell, sure, because one is before the "and", and one is after it. Not the difference you meant? There are all kinds of differences, but kids usually learn to mostly ignore casing (in English) for meaning when learning to read, and programming makes them unlearn that rule. There are three exceptions (that I think of offhand): starting a sentence, trademarks and acronyms, and proper nouns. The first two don't usually change the meaning much or at all, and the last is pretty much Python's class/instance rule (except reversed).