3 ms·
Funnily enough, I've had the same thoughts about variable names. We expect case-sensitive variable names because that's what we're used to, but they're not obvi
by tikhonj 12y ago
Funnily enough, I've had the same thoughts about variable names. We expect case-sensitive variable names because that's what we're used to, but they're not obviously the right choice. I've worked on reasonably sized lisp projects with case-insensitive names with no detriment.
Most of the time, having both a `foo` and a `Foo` identifier at the same time is a bad idea: it's hard to remember which is which. The only time it makes sense is when it's backed up by strong conventions: say, `foo` is a method and `Foo` is a class. With these conventions, you're not really remembering `foo` and `Foo`, you're remembering "`foo` method" and "`foo` class". In a sense, it's just a hack to have sigils use an otherwise unused part of the identifier, just like tagged pointers use the unused bits of a pointer for metadata.
Using capitalization for sigils like this is fine, and works well in practice, but you could as easily use some other symbols in the same role. At the very least, it helps to have the conventions built right into your language (like Haskell) than just followed manually (like Java). Moreover, having significant capitalization outside the conventions (ie in the rest of the word) will still just be confusing: was is `subString` or `substring`?
I don't know what the best solution is, but case sensitivity everywhere isn't it.
- wodenokoto 12y agoI've always thought case-sensitive variable names to be an odd thing. You allow your program to handle it and then tell the user to never ever use it.