7 ms·
Nim is an odd language insofar that every time it's pitted against other languages, it performs brilliantly on nearly every level. Yet almost nobody uses it. Re
by vegai_ 4y ago
Nim is an odd language insofar that every time it's pitted against other languages, it performs brilliantly on nearly every level. Yet almost nobody uses it. Really weird juxtaposition.
- skywal_l 4y agoQuickly scanning Nim page, there is a couple of things that bothers me in Nim. The python style blocks making multi line lambda awkward, Garbage collection, "Identifier equality" (some_variable == someVariable)... So because of the quirkiness I would understand why it is not a universally adopted language. Do you have pointers to the comparison with other languages?
- elcritch 4y agoI think the biggest issue is that Nim took a long time to “find its feet”. There was a lot of experimentation before the current sweet spot. Due to its new GC system ‘ARC’ it’s now broadly useable as a systems language, which wasn’t true before with a regular GC. ARC is non-atomic/non-locking reference count based, meaning it can be used to as a systems language (no GC pauses) or for system libraries (C programs can use it). There’s a few awkward-ish parts of the syntax, but in practice those items aren’t big issues (compared to say Rust async syntax issue). For example multi-line lambdas can be done with ‘do’ blocks or just wrapping parens. Identifier equality has actually saved me from a few bugs by accidentally creating a new similarly named variable, say an ‘isDone’ when I already had an ‘is_done’ following the style from C FFI. Though the compiler warns by default when mix naming styles, and can be set as an error if desired. Iterators usage can be a bit annoying though. I also really enjoy UFCS: https://en.m.wikipedia.org/wiki/Uniform_Function_Call_Syntax https://en.m.wikipedia.org/wiki/Uniform_Function_Call_Syntax Python comparison example: https://narimiran.github.io//2018/05/10/python-numpy-nim.html https://narimiran.github.io//2018/05/10/python-numpy-nim.htm...
- coliveira 4y agoARC is not new, it was used by Apple in their languages for at least 10 years now.
- ______-_-______ 4y agoObviously parent is not claiming that Nim invented the concept of reference counting. They're saying that it's a recent addition to Nim, and Nim's other memory management strategies have been part of the compiler for longer.
- elcritch 4y agoThat and that Nim's ARC system extends the concept a bit further to include move semantics and limited ownership rules. Nim had a traditional RC garbage collector before, but ARC is case where "the whole is greater than the sum of parts". Swift and Obj-C's ARC system relies on atomics and their associated issues (explained well here: https://news.ycombinator.com/item?id=15046481 https://news.ycombinator.com/item?id=15046481). Nim's ARC system relies on ownership rules that require a single thread to "own" any ARC-managed memory which removes the need for locks or atomics in the reference counts. That eliminates the non-determinism of locks & atomics when doing the RC accounting, overall improving latency and performance. Move semantics increase performance and enables "giving" ownership of ARC-managed memory to another thread.
- dom96 4y agoWhat's so awkward about multi line lambdas? You can achieve them in the same way you can in JavaScript, can't get easier than that. import sequtils let x = [1,2,3,4,5] echo x.map( proc (num: int): int = num*2 )
- throwaway234272 4y agoThe lambdas are terrible in nim, you currently have to `import sugar` for bandaid fix. Nim is in progress to fix them, see here: https://github.com/nim-lang/Nim/pull/11992 https://github.com/nim-lang/Nim/pull/11992 I don't see why people can't admit to shortcomings in languages? I like Nim a lot, doesn't mean I'm blind to where it falls short or needs improvement...
- poulpy123 4y agoI just started to (very slowly) learn Nim, and it's quite nice for the moment. Of course there are some points of friction, but which language doesn't have ? The documentation page has comparison with C, python and typescript/JavaScript https://nim-lang.org/documentation.html https://nim-lang.org/documentation.html
- MercurialBlue 4y ago>Identifier equality This is a very surface-level complaint, and it is no surprise that almost everyone who complains about this hasn't actually used the language. I will admit it is indeed a peculiar feature, I wouldn't be able to name another language that did this before, but as it turns out, it has yet to be a problem in practice. Do you fear some crazy person might mix identifier styles? They could do that in any language, Nim has nothing to do with that. The pro of this feature is that you can write your library in whichever style you prefer, and people can use your library and still use their preferred style, I always hated how in python you often end up having to use libraries written in camelCase for your snake_case project (or vice versa). Once again, it is a rather peculiar feature, like who asked for this? I don't know, but then again, why not? it did make me raise an eyebrow at first, but in practice, Nim gets it just right. The one valid scenario where it could get in the way is when searching your source files for an identifier, but even then Nim has solutions for that (there's nimgrep, and mainstream editors/IDEs are already nim-aware anyways).
- deleted 4y ago[deleted]
- MercurialBlue 4y agoMay I ask what exactly do you dislikes about Nim's garbage collection? You said you "quickly" scanned Nim's page, so I assume you just don't want a GC period? If you're dealing with hard-realtime constraints then I understand. But otherwise, as long as you aren't dealing with cyclic data structures, Nim's GC is just reference counting, which is very widespread in even C++ and Rust code, and if you really want to you can just not use the cycle collector and break the cycles yourself. The way I see it, the GC is just nice to have for productivity, and for those cases where you really need to optimize your program, there is nothing stopping you from managing your memory yourself, you can write your own types with their own constructors/destructors (Nim has "scope-based" memory management akin to RAII in C++), of course, you must be aware that using pointers will lead to potentially unsafe code, Nim can't hold your hand there.
- pjmlp 4y agoBecause comparing grammars and semantics is meaningless without an ecosystem and killer use case to come along with the language.
- renox 4y agoSame with D..
- verdagon 4y agoI say this as a fellow language developer: Nim is impressive as hell! I'm particularly excited about their region isolation [0]. A lot of new languages are exploring it, and it has a lot of potential to change the way we program over the next decade. [0] https://github.com/nim-lang/RFCs/issues/244 https://github.com/nim-lang/RFCs/issues/244
- mrweasel 4y agoIt lacks the branding of something like Rust, which it self tried to piggy back on Go years ago, until it got traction. C++, for better or worse continues to be a safe choice. A reasonably large user base, and it will be around for a long time. My co-worker joked that if you want your software to be able to run in the future, pick Windows and C++ as your platform. Then you’ll be good for a few decades.
- polotics 4y agoPatiently waiting for the right moment to try and introduce it at $JOB, but it's kind of hard so many developers like only the familiar...
- ryukoposting 4y agoPeople don't use Nim because the ecosystem is small, and the ecosystem is small because people don't use Nim. The solution is to make the ecosystem bigger by contributing to it. Good news! The ecosystem is small, so there's a lot of low-hanging fruit. I'm a "random guy" writing Nim in my spare time, and I develop & maintain a handful of Nimble packages. Someone might actually be using them, too. None of my packages require regular maintenance because Nim's tooling is dead simple and the language is really easy to work with. It's a great opportunity for an enthusiastic hobbyist to be a big fish in a small pond.
- vaylian 4y agoIt's been a while since I last played around with Nim (back when it was still called Nimrod). But doesn't Nim compile to C and therefore it can interact with the entire C ecosystem? And afaik it is also camel-case-insensitive, so that you can call C functions without having to worry about different naming conventions?
- ryukoposting 4y ago> But doesn't Nim compile to C and therefore it can interact with the entire C ecosystem? You can directly call C code, yes. You can even work with macros! It's a lot nicer when you can import a package that provides an abstraction layer over the C code, though (for example, my `ruby' package) > call C functions without having to worry about different naming conventions Yes. In fact, if you hand-write your C bindings instead of using something like c2nim, you can completely change the name of the function. This is a snippet from my aforementioned `ruby' package: proc evalString*(code: cstring): RawValue {.importc: "rb_eval_string".}
- jdrek1 4y agoThe ecosystem might be small but as you said it can grow and I think there's enough people out there willing to give a new language a try if it seems appealing enough, it's quite common to try a new language for Advent of Code for example. That being said, honestly the thing that stops me from trying/using Nim that the compiler enforces a style and that style is just wrong (it enforces spaces). Same goes for Go which enforces the opening brace on same line style. The people writing those languages can have whatever style they like for their code, but forcing me to use it is very off-putting to say the least. I get that this is probably a minor issue for most people but I can't deal with change that well and things like this are super annoying, especially since there is not one single reason for forcing a certain style on everyone. I'm aware that `#? replace(sub = "\t", by = " ")` works, but it's a hack and I'd have to inject it everywhere, not a good solution. But at least it's better than Go in this regard.
- indymike 4y agoIt takes time for the ecosystem to emerge... and I think Nim's future is very bright.
- lenkite 4y agoc_asEAnd_UnDeRscoReI_nSen_Sitivity doesn't get many fans
- dinHeld 4y agoYeah... using absurd names like that is on the developer, not the programming language. You can do useless stuff like that in any language.