News for hackers. Stuff that matters.
Re:Nim 2.0.0 RC2 by 000ooo000 on Friday March 31, 2023 @08:32AM (#35386101)
Can't get past the style insensitivity thing. Seems like a ridiculous 'feature' to build into a lang.
Re:Nim 2.0.0 RC2 by pa7x1 on Friday March 31, 2023 @08:40AM (#35386207)
The only situation I can imagine this causing a problem in your codebase is if you intentionally want to mix camelCase and snake_case in your codebase and these 2 meaning different things. So if you don't enforce in your codebase a specific code style practice and you would like someFunction and some_function to coexist and mean different things, then yes. Nim's approach is problematic for you.

If you enforce a code style or, if you don't but you would convene that someFunction and some_function should mean the same thing in your codebase. Then nim's approach should be transparent to you.

Re:Nim 2.0.0 RC2 by overthrow on Friday March 31, 2023 @08:46AM (#35386280)
It also makes it a bit harder to grep a codebase. If you're on a team of 10 devs someone could have accidentally forgotten an underscore sometime last year. So you can't just grep for 'ready_for_upload', you have to use 'ready_?for_?upload'
Re:Nim 2.0.0 RC2 by pa7x1 on Friday March 31, 2023 @08:51AM (#35386361)
This is a valid observation.

I suspect, in practice, almost everyone follows the sane approach of enforcing a code style in your codebase. I think what usually gets lost when this is brought up is that the point of this code style insensitivity is not to encourage you go to crazy and mix and match it in your projects. It's so external dependencies don't have to infect your codebase. So you can actually apply a consistent code style within your project.

Re:Nim 2.0.0 RC2 by planetis on Friday March 31, 2023 @09:00AM (#35386471)
There are warnings raised by default, like this:

test.nim(2, 8) Hint: 'myvar' should be: 'myVar' [var declared in test.nim(1, 7)] [Name]

Re:Nim 2.0.0 RC2 by cardanome on Friday March 31, 2023 @08:51AM (#35386359)
Again, not if you enforce a code style which nearly always should in a professional context.

Such a mistakes is easy for a linter to pick up on so that the code would never be merged in the first place.

Re:Nim 2.0.0 RC2 by overthrow on Friday March 31, 2023 @08:57AM (#35386429)
How does the linter treat 'get_file_system' and 'get_filesystem'? Which one would be flagged as an error?
Re:Nim 2.0.0 RC2 by ptramo on Friday March 31, 2023 @10:14AM (#35387461)
The one that doesn't match the declaration.
Re:Nim 2.0.0 RC2 by overthrow on Friday March 31, 2023 @10:43AM (#35387883)
A parent comment says:

> It's so external dependencies don't have to infect your codebase. So you can actually apply a consistent code style within your project.

Say an external dependency has a declaration called 'getFileSystem', and in my Nim codebase I refer to it as 'get_file_system', but last year someone accidentally committed 'get_filesystem'. In this case neither usage matches the declaration. Does the linter flag both spellings because they don't match 'getFileSystem'?

EDIT: And what about reflection? If someone wrote `newCall("get_filesystem")`, will the linter fix that usage too?

Re:Nim 2.0.0 RC2 by darthrupert on Friday March 31, 2023 @08:52AM (#35386364)
I think there was a flag that allows you to turn bad style in identifiers into compile errors. It isn't but imho should be on by default.

edit --styleCheck:error perhaps?

Re:Nim 2.0.0 RC2 by michaelsbradley on Friday March 31, 2023 @08:48AM (#35386303)
Use nimgrep?
Re:Nim 2.0.0 RC2 by Nullabillity on Friday March 31, 2023 @08:59AM (#35386464)
Ripgrep is already integrated into my editor and muscle memory. Nimgrep is just yet another special case tool that only exists because Nim decided to spend its weirdness budget on inconsequential nonsense.
Re:Nim 2.0.0 RC2 by xigoi on Friday March 31, 2023 @12:17PM (#35389347)
The “weirdness budget” concept is nonsense. Are you saying that programming languages should do only some things right?
Re:Nim 2.0.0 RC2 by overthrow on Friday March 31, 2023 @08:54AM (#35386391)
Can you integrate that into an IDE? In many IDEs, if you hit ctrl-shift-f, it will search the project for the selected text with just one keystroke. Can vscode be made to Do The Right Thing for Nim without extra fiddling on every search?
Re:Nim 2.0.0 RC2 by michaelsbradley on Friday March 31, 2023 @09:00AM (#35386466)
Good question, but I don't know the answer (yet) because I don't use vscode, sorry.
Re:Nim 2.0.0 RC2 by Manabu-eo on Tuesday April 04, 2023 @08:23PM (#35447612)
Your Nim project will be in a consistent casing, otherwise the compiler will be warning you about inconsistent spelling. Regular Ctrl-shift-f will work just fine.
Re:Nim 2.0.0 RC2 by planetis on Friday March 31, 2023 @09:05AM (#35386533)
@Nullabillity The only nonsense we are dealing with constantly is opinions of people who haven't ever bothered to use this feature before declaring it "inconsequential nonsense".
Re:Nim 2.0.0 RC2 by Nullabillity on Friday March 31, 2023 @09:15AM (#35386665)
whodoesthissocalledfeaturehelpandwhatkindofcodedoesitencourage

iwouldnotwanttoworkinanenvironmentwherethiswasaseriousproblemthatpeoplethoughtneededsolving

Re:Nim 2.0.0 RC2 by planetis on Friday March 31, 2023 @10:41AM (#35387872)
Very mature, congratulations! Naming has nothing to do with style insensitivity. You can write M_ya_wse_s_omEv_ar in any language, yes? Proof that you don't understand what you're arguing about.
Re:Nim 2.0.0 RC2 by Nullabillity on Friday March 31, 2023 @10:55AM (#35388060)
> You can write M_ya_wse_s_omEv_ar in any language, yes?

Yes? That doesn't mean that we should add features that encourage that kind of confusion. Especially not when they, again, help nobody and bring no actual benefit.

Re:Nim 2.0.0 RC2 by stefncb on Friday March 31, 2023 @11:39AM (#35388762)
If anything, it encourages a consistent style, since you don't have to use whatever style your dependency uses.

Also, if you work with people that name things like that, it's not really Nim's fault?

Re:Nim 2.0.0 RC2 by Nullabillity on Friday March 31, 2023 @12:49PM (#35389774)
Somehow pretty much every other ecosystem can just pick one style and stick to it, negating the problem entirely.

I have never come across a Rust project that didn't use snake_case, or a Java project that didn't use camelCase.

Re:Nim 2.0.0 RC2 by monetus on Friday March 31, 2023 @11:24AM (#35388501)
(Not who you responed to)

Just to argue against there being no benefit, I have a cognitive impairment that occasionally puts me in an altered state, a delirium to varying degrees. camelCase is much more difficult to read at that point, so I can get confused ridiculously easily. I tend leave a bunch of comments and then step away, but sometimes I can work well through it; things like horrendous variable names/regexs will throw me. I default to snake_case but compile over when I share the code.

This is my unique situation and predilection to being able to read one form more easily than another, but it does indeed help me.

Re:Nim 2.0.0 RC2 by Nullabillity on Friday March 31, 2023 @12:47PM (#35389755)
That's understandable, but doesn't that cause the same issues when reading documentation or third-party code?
Re:Nim 2.0.0 RC2 by monetus on Friday March 31, 2023 @02:47PM (#35391514)
I can back away from those while leaving the tabs open and be not too confused coming back, not having temporarily broken them. When I'm in the middle of refactoring especially though, getting a seizure and trying to back away without jumbling the house of cards is a lot easier with whatever pattern recognition I have around snake_case.

Edit: curious, have a preference besides consistency for cases?

Re:Nim 2.0.0 RC2 by v3ss0n on Friday March 31, 2023 @12:56PM (#35389885)
Why would someone change its tooling because of a particular Language ?
Re:Nim 2.0.0 RC2 by Manabu-eo on Tuesday April 04, 2023 @08:18PM (#35447583)
Do you use it regularly? I don't, and I don't have any problem finding what I need with regular ctrl+F in Nim, because Nim projects are internally consistent in terms of style, with the compiler helping enforcing it with `-styleCheck`.

So don't bring up nimgrep like it's a necessity when it's more of a last resort tool nowadays. You will be just attracting flaming.

Re:Nim 2.0.0 RC2 by frou_dh on Friday March 31, 2023 @09:45AM (#35387073)
Tooling (In this case, "Find References") should understand language semantics. Not that I think that this specific feature of Nim is particularly appealing, but pandering to 1970s stone-age tooling forever is just sad.
Re:Nim 2.0.0 RC2 by mtinkerhess on Friday March 31, 2023 @10:23AM (#35387600)
You don't always get to pick your tools. If you're using GitHub, ctrl+F should find what you're looking for.
Re:Nim 2.0.0 RC2 by xxpor on Friday March 31, 2023 @11:48AM (#35388902)
As a C programmer where the codebases I work on have never adopted any sort of style enforcement: sounds like a normal day to me.
Re:Nim 2.0.0 RC2 by Nullabillity on Friday March 31, 2023 @09:11AM (#35386611)
It would be one thing (but still a weird feature that calls the rest of their decision making into question) if it normalized fooBar into foo_bar (or the opposite). But that's not what it actually does, it normalizes both into foobar, which introduces new ambiguities. In fact, you can often end up with the opposite meaning! For example, a few Swedish examples:

- hand tvättas (wash your hands) != handtvättas (wash by hand)

- sjuk gymnast (sick gymnast) != sjukgymnast (physical therapist)

- sjuk sköterska (sick nurse) != sjuksköterska (hospital nurse)

- lång hårig (tall and hairy) != långhårig (long-haired)

- sjö nära tomt (lake near a house) != sjönära tomt (house near a lake)

Re:Nim 2.0.0 RC2 by tokai on Friday March 31, 2023 @09:29AM (#35386852)
Natural language compound words has no bearing on a discussion on Nim. It makes even less sense to use a language full of compound words like Swedish, when Nim is written in English - a language where compound words are less common and flexible.
Re:Nim 2.0.0 RC2 by Nullabillity on Friday March 31, 2023 @09:31AM (#35386881)
Nim itself, or the code bases written in Nim?
Re:Nim 2.0.0 RC2 by Tommstein on Friday March 31, 2023 @07:58PM (#35395434)
Nim forces you to use English identifiers?
Re:Nim 2.0.0 RC2 by netbioserror on Friday March 31, 2023 @09:15AM (#35386661)
These examples apply to a codebase...how?
Re:Nim 2.0.0 RC2 by konart on Friday March 31, 2023 @09:31AM (#35386896)
Method\variables naming?
Re:Nim 2.0.0 RC2 by fredrikholm on Friday March 31, 2023 @09:39AM (#35387003)
I'm a Swede working in Sweden and Norway, and I've never seen any code written in a Scandinavian language (thank god).
Re:Nim 2.0.0 RC2 by dieortin on Friday March 31, 2023 @12:04PM (#35389142)
Variables are usually named after things, so of course they apply to a codebase. How would they not apply?
Re:Nim 2.0.0 RC2 by WesolyKubeczek on Friday March 31, 2023 @09:16AM (#35386681)
Another situation is when you have to interface with some other language that doesn't have this feature and where nameLikeThis and name_like_this both exist and mean different things. Thus requiring you to work it around with a third naming convention.

Here's one illustration: https://github.com/nim-lang/RFCs/issues/456#issuecomment-111...

We have partial case-insensitivity in PHP. Can't say I'm very fond of it, but I'm ambivalent as long as it's not abused.

Re:Nim 2.0.0 RC2 by xigoi on Friday March 31, 2023 @12:20PM (#35389376)
You should rename foreign identifiers anyway. C names are usually very cryptic.
Re:Nim 2.0.0 RC2 by WesolyKubeczek on Friday March 31, 2023 @06:18PM (#35394463)
This has a drawback that when reading the original documentation, not only do you have to mentally translate the code examples into your target language, but also translate the identifiers too.

And "C names are usually very cryptic" is plain false, unless you talk about APIs coming from the ages and compilers where all identifiers had to be 8 characters or fewer in length.

Re:Nim 2.0.0 RC2 by nerdponx on Friday March 31, 2023 @09:35AM (#35386950)
* * *
Re:Nim 2.0.0 RC2 by xigoi on Friday March 31, 2023 @12:19PM (#35389363)
> This is literally idiomatic Python style! Classes are TitleCase and everything else is snake_case.

And Nim does distinguish between those.

> I've written names like "fooBar_prev"

That's disgusting.

Re:Nim 2.0.0 RC2 by v3ss0n on Friday March 31, 2023 @12:53PM (#35389839)
This is done a lot in Python Libraries the module with lower_case and class name with TitleCase . In Nim's Case (No Pun Intended) it is a fatal mistake.
Re:Nim 2.0.0 RC2 by dsrw on Friday March 31, 2023 @02:11PM (#35390963)
This particular example isn't actually an issue in Nim. The first letter of a nim identifier is case sensitive, so while `my_thing` and `myThing` are normalized to the same name, `my_thing` and `MyThing` are different.
Re:Nim 2.0.0 RC2 by 000ooo000 on Friday March 31, 2023 @08:50PM (#35395826)
I'm not sure I understand the rationale of it if using a consistent naming approach (best practice) renders it transparent, and compiler warnings alert you to instances where one is using e.g. my_var and myVar. Seems like the capability is there but the typical advice and compiler both warn against taking advantage of it. Just seems like a footgun to me. What am I missing?
Re:Nim 2.0.0 RC2 by Manabu-eo on Tuesday April 04, 2023 @08:25PM (#35447631)
It's there to allow you to have a consistent naming approach inside your project, regardless of the naming approach of the libraries you are using.
Re:Nim 2.0.0 RC2 by kwhitefoot on Friday March 31, 2023 @08:38AM (#35386187)
I think the opposite. Case sensitivity beyond the first character just makes life difficult.
Re:Nim 2.0.0 RC2 by geenat on Friday March 31, 2023 @08:44AM (#35386249)
It's a big plus for library and FFI interop so external styles don't take over your entire project.

Also, John Carmack: https://mobile.twitter.com/id_aa_carmack/status/159256093820...

Re:Nim 2.0.0 RC2 by IshKebab on Friday March 31, 2023 @11:05AM (#35388188)
Plenty of programming languages have "did you mean xxx?" in error messages. Plus using IDEs means you will mostly autocomplete identifiers anyway. I don't buy it.
Re:Nim 2.0.0 RC2 by otherme123 on Friday March 31, 2023 @01:13PM (#35390045)
The point is to use third party libraries while keeping your prefered case in your code. You prefer your code in CamelCase, but some other guy made a library in snake_case. Still you can use the library using CamelCase, and not mixing.

E.g. The Python Selenium library used to be in CamelCase, while almost all code in Python is snake_case. By using Selenium you ended up with code like:

    my_button = browser.getElementById("Button")
They rewrote the whole library to be in snake_case, a change that forced a lot of code rewrite downstream. Even the Python builtin library has case inconsistencies (logging module is camelCase, sys has both alllowercase and snake_case) that weren't fixed even in 2to3.

Nim would have handle this efortlessly, allowing you to use get_element_by_id or getElementById in the old library, and avoiding you the effort to rewrite your code if the Selenium mantainers decided for a case change. You can refactor your case without fear of making life worse for your users.

Re:Nim 2.0.0 RC2 by gjm11 on Friday March 31, 2023 @04:34PM (#35393244)
An alternative design would be: when you bring in an external library, there's a mechanism to rename the symbols in it.

The downside is that for each library you want to do this to, _once_ you have to spend a few minutes writing the renamings.

The upside is that if you now want to find everything that uses the external function getElementById, you can search for _that_, and you will find the "rename getElementById as get_element_by_id"[1] declaration, and then you know to search your project for get_element_by_id to find all the places where it's used.

[1] I am not suggesting that particular syntax; I just picked something at random.

The other upside is that if you want to find uses of the getFoobar function that's defined in your project, you just have to search for getFoobar rather than doing a case-insensitive regex search for "_*g_*e_*t_*f_*o_*o_*b_*a_*r_*". (Or, if your answer to that is to use language-specific tooling, that you aren't forced to use language-specific tooling when it might be more convenient to do searches on the GitHub website, or in the text editor / IDE that everyone else on your team uses, or in the text editor / IDE that you'd been using for years before starting to use Nim.)

To me, this seems like an obviously better design. I don't want people who have spent years becoming productive in Emacs, or Vim, or Visual Studio, or whatever, to have to choose between using some different set of tools they aren't used to and having the searching operations they're used to using silently do the wrong thing.

Am I missing something? Because, rightly or wrongly, this one weird design decision is enough to keep Nim off my list of languages that are worth the time to investigate: not because this single thing makes that much difference on its own (though it does feel as if it would make my life substantially worse, if I were writing a lot of code in Nim) but because I feel like the language is designed by someone who makes weirdly terrible design decisions sometimes, and if that's what I want then I already have C++ and Javascript :-).

Re:Nim 2.0.0 RC2 by cb321 on Friday March 31, 2023 @04:52PM (#35393481)
Re:Nim 2.0.0 RC2 by xigoi on Saturday April 01, 2023 @04:44PM (#35403887)
> you just have to search for getFoobar rather than doing a case-insensitive regex search for "_g_e_t_f_o_o_b_a_r_"

Are you seriously expecting that someone will but an underscore in the middle of a word?

Re:Nim 2.0.0 RC2 by gjm11 on Tuesday April 04, 2023 @03:54PM (#35445068)
I'm not expecting anyone to turn getfoobar into getf_oobar, no. But (1) there are cases where people might disagree about whether something is one word or two (do you want to bet no one has written "white_space" where you wrote "whitespace"?) and (2) there are weird cases where the same string of letters can be split into words (or sufficiently word-like pieces) in multiple ways.

I don't have a plausible example of #2 in mind. Maybe there aren't any. (There are definitely lots of things that break into words in multiple ways, of course, but maybe there aren't any that make plausible identifier names more than one way. Though for what it's worth I bet there are.) And in any given case you can check, given a few seconds' thought, that there aren't other possibilities. But that little extra cognitive load is a bigger deal than it sounds like -- it's a distraction from other things -- and if you don't do the check then you'll never know whether your search operation actually found everything it should have.

So you can check by eye every time. Or you can write the ugly regexp every time. Or you can just accept that what ought to be a perfectly simple operation isn't quite right and might invisibly go wrong some time.

That's not a set of options I like.

Re:Nim 2.0.0 RC2 by Manabu-eo on Tuesday April 04, 2023 @07:42PM (#35447337)
First, you are aware of `--styleCheck:usages` and `--styleCheck:off|hint|error` that by default already warns the user if he is not consistent on the spellings of identifiers? So you ever just have to search by one form inside your projects.

As far as renaming external libraries goes, if the original name is get_foobar, and the project uses snakeCase, I would be very surprised if it's renamed to anything other than getFoobar. There are slightly more tricky stuff like get_ID, but even then there are only a couple of reasonable forms to search for. And it's rare to be searching for things you haven't seen used, and if you saw it used you know how it's spelled in that library.

I've been programming for years in Nim and never had any problem grepping or searching for things because the style insensitivity.

I don't think it's reasonable to force every developer to spend a few minutes writing renamings if virtually all of them are obvious mechanical transformations, just because a paranoia not substantiated by experience.

Re:Nim 2.0.0 RC2 by IshKebab on Saturday April 01, 2023 @02:47AM (#35397823)
> The point is to use third party libraries while keeping your prefered case in your code.

Third party Nim libraries? Because if the all used the same style this would never be needed in the first place.

Rust never has this issue because everyone uses the same style.

Re:Nim 2.0.0 RC2 by planetis on Saturday April 01, 2023 @10:25AM (#35400537)
Bleh I don't like snake_case, it results in long identifiers
Re:Nim 2.0.0 RC2 by 000ooo000 on Friday March 31, 2023 @08:56PM (#35395863)
Carmack's tweet seems like more of a thought provoking question than an indictment of case sensitivity. I'm not sure I am convinced that a child stumbling over case sensitivity is a smoking gun. I just explained it to my nontechnical partner and before I had finished and proposed a "what do you think?" kind of question, she had given a "oh,hmm" to the idea that "abc" and "ABC" might mean the same thing when used as variables. Again, no smoking gun here either.
Re:Nim 2.0.0 RC2 by michaelsbradley on Friday March 31, 2023 @08:46AM (#35386271)
I was annoyed by it at first, but got past that, and now don’t think too much about it. With tooling support (mainly lang server and nimgrep) I haven’t found it to get in the way, and have come to appreciate the flexibility it provides.
Re:Nim 2.0.0 RC2 by planetis on Friday March 31, 2023 @08:51AM (#35386357)
I have extensively used Nim for the past 6 years, and it has never been an issue. I have seen codebases where someone wrongly capitalized a variable identifier, which results in a compiler warning being raised. So no harm done.
Re:Nim 2.0.0 RC2 by tryptophan on Friday March 31, 2023 @09:57AM (#35387250)
I cant think of a single situation in which I would want take_action() and Take_Action() to do different things inside of a program. What reasonable purpose would naming things that way serve?

I see it as a mandated style checker built into the language.

Re:Nim 2.0.0 RC2 by IshKebab on Friday March 31, 2023 @10:20AM (#35387557)
Nobody wants codebases with different take_action() and Take_Action() functions. That's a straw man.

The issues are:

1. Difficult to search code. Even just case insensitivity makes this worse because often you do have names that only differ in case (but in an acceptable way, e.g. they're different kinds of thing, or namespaces). But ignoring underscores makes it much much harder - now every search needs to be a regex.

You can say "use an IDE!" and you absolutely should but you still sometimes need to search with dumb grep style tools.

2. Case insensitive rules are always more complex and difficult to remember. Where do they apply? All identifiers or just variables? What about keywords. Nim's rule is especially complex. It adds cognitive load.

3. Extra bike shedding. I imagine they added it to avoid bike shedding? But it will have the opposite effect. They should have just made a language wide convention like Rust. Nobody debates case style in Rust or indentation style in Go because the tooling and community pretty much force one style.

I fully anticipate a Nim linter that bans style variation from the canonical one. If that doesn't exist already.

Re:Nim 2.0.0 RC2 by xigoi on Friday March 31, 2023 @12:21PM (#35389398)
> They should have just made a language wide convention like Rust.

I don't know about Rust, but Python has a language-wide convention – and programs still violate it, including the standard library.

Re:Nim 2.0.0 RC2 by runarberg on Friday March 31, 2023 @01:39PM (#35390401)
In JavaScript (the wild west of programing languages) when I see a library that exports names in non-idiomatic ways, or otherwise has a non-idiomatic API, I usually search for a different library.
Re:Nim 2.0.0 RC2 by xigoi on Friday March 31, 2023 @09:29PM (#35396077)
The DOM API, which is objectively the most important JavaScript library, has an inconsistent naming convention. Specifically, it can't decide whether it wants to treat acronyms/initialisms as words. See for example getElementById versus innerHTML.
Re:Nim 2.0.0 RC2 by runarberg on Saturday April 01, 2023 @02:07AM (#35397591)
I do like Array.prototype.includes vs. Element.classList.contains also which APIs use promises vs. callbacks vs. events. Like I said, JavaScript is the grandmaster of mixing and mashing idioms.
Re:Nim 2.0.0 RC2 by IshKebab on Saturday April 01, 2023 @02:50AM (#35397839)
Very rarely though in my experience.
Re:Nim 2.0.0 RC2 by otherme123 on Friday March 31, 2023 @01:17PM (#35390097)
It doesn't seen like a strawman when in Python you are forced to write like this:

    import logging
    import sys

    sys.breakpointhook()
    sys.exc_info()
    logging.getLogger(__name__)
And both `sys` and `logging` are not obscure builtins, they are used everywhere. And just for that, case is not fixable.
Re:Nim 2.0.0 RC2 by IshKebab on Saturday April 01, 2023 @02:49AM (#35397832)
Is there also a `get_logger()` or `excInfo()`? I don't think so.
Re:Nim 2.0.0 RC2 by xigoi on Saturday April 01, 2023 @04:48PM (#35403914)
Why does that matter?
Re:Nim 2.0.0 RC2 by IshKebab on Sunday April 02, 2023 @07:13AM (#35409321)
Because the original comment was about two similarly named but different functions. Otherme123's example didn't have that.
Re:Nim 2.0.0 RC2 by Manabu-eo on Tuesday April 04, 2023 @08:11PM (#35447525)
1 - Every search? What nightmarish code base are you imagining? That paranoia is not based on experience.

2 - Negligible cognitive load in my experience. You can just ignore that part of the language and treat it as case sensitive and everything will work. Inside projects it's effectively case sensitive too. And the rules just make sense, they are just there to allow you to be consistent in your casing, nothing less nothing more. It applies everywhere they are need for that, and nowhere else.

3. Gofmt wasn't a thing when Nim(rod) started and now is too late to force all projects to a single style. But projects are internally consistent, and you can always use your preferred style, so I consider Nim's a superior solution.

> I fully anticipate a Nim linter that bans style variation from the canonical one. If that doesn't exist already.

The compiler already warns you by default if you are not consistent on the spelling of identifiers inside your code, and you can make that an error too. See `--styleCheck:usages` and `--styleCheck:off|hint|error`. There is a nim linter that can make your code conform to NEP-1, but last time I saw it was a bit too buggy in that style transformation, so people don't usually use it.

I've been programming for years in Nim and never had any problem grepping or searching for things because the style insensitivity. In pratice it's a non-problem.

Re:Nim 2.0.0 RC2 by 000ooo000 on Friday March 31, 2023 @08:32PM (#35395701)
IMHO from a theory POV, it violates the/my principle of least surprise. Compilers are typically strict and I'm ok with that - my mental models of programing are built around that unforgivingness and I like it, because if I play by the rules, I know there'll be no surprises (ideally). When the rules are relaxed, I have to remember more stuff. It's easier for me to know that ABC is ABC, and never abc or a_b_c.

I think I remember reading early remarks from the Nim team that you can opt-in to the symbol sensitivity but it's a marker comment per-file, or some kind of DIY preprocessor which does the same. I'd be happy if it was a CLI switch.

All that said, and in practice, clearly a lot of people are fine with this and even like it. I'd much rather Nim exist with this (IMO) oddity than not at all.

Re:Nim 2.0.0 RC2 by chomp on Friday March 31, 2023 @12:03PM (#35389115)
Most of my complaints about this went away with --styleCheck:error. You might already know about this flag, but some people do not. Most projects I have found stick pretty closely to NEP1.
Re:Nim 2.0.0 RC2 by treeform on Friday March 31, 2023 @12:40PM (#35389642)
Style insensitivity does not really come up once you start using the language.
Re:Nim 2.0.0 RC2 by nrclark on Friday March 31, 2023 @03:03PM (#35391766)
I agree. It's one of my biggest gripes with the language. It has big effects on greppability. And by extension, it also has effects on search-engines. Both large ones like Google, and small ones like Github's or StackExchange's built-in engines. Even browser-search on an API document could be problematic.

If I'm looking for some example code that uses my_testfunction(), I can't just search for "my_testfunction nim". Instead I have to add MyTestFunction, my_test_function, MYTESTFUNCTION, etc. The case-insensitivity isn't really a big deal, but the underscore-insensitivity is.

If I'm honest, I think this is a big problem for adoption of the language. It's incompatible with a lot of search-engines, and weird to anybody coming from any other programming language. Nim should take advantage of the 2.0 release to do a compatibility break in this area, maybe with a compiler flag to enable the legacy behavior.

Re:Nim 2.0.0 RC2 by Tommstein on Friday March 31, 2023 @07:51PM (#35395372)
> If I'm honest, I think this is a big problem for adoption of the language.

Can confirm, it single-handedly kept me away from the language.

Re:Nim 2.0.0 RC2 by xigoi on Saturday April 01, 2023 @04:41PM (#35403859)
Pretty much all Nim projects use a consistent naming style, so this is not a problem in practice.

> Nim should take advantage of the 2.0 release to do a compatibility break in this area, maybe with a compiler flag to enable the legacy behavior.

No thanks, I don't want inconsistent naming conventions in my code.

Re:Nim 2.0.0 RC2 by arc619 on Wednesday April 05, 2023 @05:02PM (#35460341)
Your argument applies to style sensitivity as well to be fair - do you search for 'MyTestFunction' or 'my_TestFunction'... or was it 'My_TestFunction', maybe 'm_Y_tEsT_fUnCtION'?

Style insensitivity lets you automate your local code (and/or through CI) to consistency for easy searching, even when external libraries YOLO their own style.

> It's incompatible with a lot of search-engines

Google and search engines are case insensitive, and mostly ignore underscores too. Let's be honest, how often would you just search for 'testfunction libraryname' on the web and get the signature you need?

My experience from using the language in production for years is that case insensitive searches will find what I want in Nim code specifically because no one can use case/underscores to make things make unique. Instead, the language uses overloading through the type system to distinguish things. This is a far more succinct, safe, and expressive way of writing code from my perspective.

It's worth noting that the first letter of an identifier is case sensitive, with the convention for types to start with a capital letter. So, you can write 'type Test = object' and 'proc test(t: Test)', then use them with 'var test: Test; test(test)' without any ambiguity, and with code completion/jump to source in VSCode (and others).

If you then add 'proc test()' with no arguments, it's still unambiguous because the functions have different signatures, so you can then write 'test()' and your second function is called.

If something is ambiguous, it's a compile time error. If you want, you can prefix modules like Python, but there's never any need. If you have two libraries with the API, same types, and function signatures (such as using two async libraries in the same program), you can just slap a generic '[T]' so it's lazily instantiated at the call site and move on.

IMHO relying on casing/underscore to distinguish identifiers is objectively worse than using the type system to statically and unambiguously prove your intent, and normalising names removes a class of identifier confusion bugs to boot. Even style guides in case sensitive languages beg us not to use case and underscores to disambiguate symbols for the confusing code it creates, and to be honest, I've yet to see a compelling argument in favour of case sensitivity beyond simply being what people are used to.

Re:Nim 2.0.0 RC2 by Tommstein on Friday March 31, 2023 @07:48PM (#35395349)
Same. Was strongly considering getting into Nim, but screw that, not interested in needing special tooling for something as basic as reliably grepping Nim code, there's too many other languages out there.
Re:Nim 2.0.0 RC2 by otherme123 on Monday April 03, 2023 @11:56AM (#35425972)
In this thread there are people who say "a convention is enough", but then don't give enough credit to the Nim convention. Maybe you are imagining a Nim library abusing this ability, and the same developer writing all different versions allowed: write_file, writefile, writeFile, w_ri_tefil_e...

Nim developers are as smart as any other, and they like and write clean codebases adhering to the convention in NEP1. The ability to mix cases is used to fix libraries without having to disrupt their users.

I've seen this kind of complains over and over: a new language emerges (e.g. Python 20-30 years ago), and what people finds the absolute showstopper is the indents instead or braces, a minimal part of the language that should not bother a competent programmer at all. The same people that were writting old PHP or old Perl, go figure, complainig that Python whitespace is ugly.