6 ms·
The flip side is one has to use a Nim-specific search tool to find occurrences of an identifier.
by jjnoakes 8y ago
The flip side is one has to use a Nim-specific search tool to find occurrences of an identifier.
- dom96 8y agoIn practice you really don't. As kungtotte alluded to, no one is going to be mixing coding conventions inside a single code base. As soon as you see the first identifier is camelCase you can safely assume that the rest of them are also camelCase, and therefore search using camelCase.
- beagle3 8y agoI'd say that's only mostly true - if you had a typo, and wrote "camelcase" instead of "camelCase" in just one place out of a hundred, you might not notice it, but it will compile, and not match a grep (though it will match nimgrep). This case could be solved by "grep -i" or equivalent, but not the camelcase vs. camel_case case. This is not criticism; I prefer Nim's mostly-case-and-underscore-insensitive approach, but I think this is a pitfall that should be acknowledged and taken into account (which is quite easy to do given the included nimgrep). Perhaps it makes sense to have an optional warning in case a name is inconsistently spelled inside the same compilation unit.
- nimmer 8y ago> if you had a typo, and wrote "camelcase" instead of "camelCase" in just one place out of a hundred There are already formatter tools that check for that. Also, any editor with completion will suggest the right form every time preventing the bug.