5 ms·
> Of all the kitchen-sink features that Nim has, I can't accept camelCased == under_scored names otherwise it could have been first. Just to clarify for the ge
by narimiran 7y ago
> Of all the kitchen-sink features that Nim has, I can't accept camelCased == under_scored names otherwise it could have been first.
Just to clarify for the general public (because this is often a source of confusion and misunderstandings): first letters are case-sensitive in Nim, so you can do `var car: Car` (where `car` is a name of the variable, and `Car` is a type).
When it comes to style-insensitivity, I also thought this would be a problem when I discovered Nim, but now—2 years later—there was not even one situation where that would cause a problem. (And if you use different styles of the same name to mean different things in other languages: this will bite you sooner or later)
Nim's standard library is written uniformly in camelCase style, which is what I also accepted for my code (even though I come from snake_cased Python).
So why this even exists? To make easier to use libraries written (in another language, e.g. C) in another style, while keeping the uniform style in your code. Basically, this feature makes it easier to use just one style consistently.
To conclude:
If this is the only (or just a major) thing that keeps you from using Nim: I would suggest you to reconsider and give it a chance.
- PMunch 7y agoAbsolutely! I hear this complaint a lot for people who seem to read about the language without ever trying it out. It does sound a bit crazy to begin with, but not having to write code that's a mish-mash of styles while still being able to use a library written by someone who didn't adhere to the style guide is a really nice feature.
- karmakaze 7y agoI don't see how this is required for one drop and if that's the use case, it sho_uLd only be used there and not everywhere. It makes it harder for tooling and for searching for all references. Inconvenient, like spaces in filenames.
- nimmer 7y agoOne of the main benefits is in wrapper libraries for C. Another one is using libraries that have a naming style that I don't like. Searching for names is not a problem as people don't mix different styles within the same project. Also there's nimgrep for this. Finally, getting a compiler error when I try to use variables called should_run and shouldrun in the same scope is a feature, not a bug: it encourage using less misleading names.
- karmakaze 7y agoIf it treated 'same scope' to mean something more like a module (i.e. library), that would be better. Also, it should never consider hell_owl and hello_w_l to be the same, although each could match hellOwl and helloWL. Basically it takes the style-insensitivity too far.
- nimmer 7y agoAnd yet, after using Nim for many years hell_owl == hello_w_l has never been a problem. Again, it warned me in few occasions when I tried using confusing names like new_dir and newdir. There are style guides and nimpretty to help further.