5 ms·
Why use Nim over Go?
by j88439h84 6y ago
Why use Nim over Go?
- navdb 6y agoSome people prefer Nim because of small things like syntax. However Go is much more popular. I will do more research on this subject and see if I can list the differences in detail. However any such list could be soon made redundant when Go 2 comes out.
- bE9a3S5So8igd3 6y agoMost of your list would probably remain intact. The main issue is that Go has a traditional garbage collector, and Nim has ARC, ORC, nogc, gogc, deferred reference counting, and more options for memory management.
- vips7L 6y agoWhy are options a bad thing? What's the default? Is it reasonable?
- bE9a3S5So8igd3 6y agoI'm using the literal definition, "an important topic or problem for debate or discussion." By the main issue I mean the main matter of discussion/point of interest/topic to cover. Not suggesting there is something wrong with Nim's having various means of memory management. Default currently is refc (deferred reference counting) and it's reasonable. Arc is better for some use cases but not as ironed out as refc.
- nimmer 6y ago> small things like syntax This is no small thing. The expressiveness of a language makes the difference between happy productivity and tedious typing and swearing. Nim is in the same ballpark as Python here, while many other languages require a lot of boilerplate.
- lactobacillis 6y agoPeople complain about lack of generics and proper try/except/finally in Go. Nim has both.
- sagichmal 6y agoAnd no native concurrency.
- throwaway_pdp09 6y agoIt's not my area but, surely concurrency can be added, and why does it need to be native? Surely a library is fine. (I chose not to learn go because of it's lack of generics and exceptions. It seemed like a huge step backwards)
- PMunch 6y agoNim has thread support natively. And an async implementation in it's standard library which is made entirely as a library, so you're free to write your own, in fact there exists alternative implementations of async/await in Nim. Just the fact that a feature like this _can_ be implemented as a library is a testament to how powerful of a language Nim is.
- navdb 6y agoRelated article on Nim concurrency: https://onlinetechinfo.com/concurrency-and-parallelism-in-nim/ https://onlinetechinfo.com/concurrency-and-parallelism-in-ni...
- beagle3 6y agoWhy do you say that? It's far from perfect but it does work (and has for a few years), and it helps you by requiring proof that actions are disjoint. There is work now on including Z3 which would work this much smarter. https://nim-lang.org/docs/manual_experimental.html#parallel-amp-spawn-parallel-statement https://nim-lang.org/docs/manual_experimental.html#parallel-...
- benibela 6y agoThen let's ask instead, why use Nim over Pascal?
- smabie 6y agoNim has actually decent type-system with support for algebraic data types and generics. Moreover, Nim is a much higher level language and doesn't sacrifice performance to do it. In short, while Go has deliberately shunned all modern developments in PL design, Nim has embraced them. Also Nim has real macros, while Go does not. It's clear to me that though immature, Nim is a much better and more expressive language than Go.
- pansa2 6y agoNim seems to be almost the anti-Go. While Go is all about simplicity and "less is more" [0], Nim's list of features [1] is huge. Therefore, I think the two languages appeal to different sets of people. [0] https://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html https://commandcenter.blogspot.com/2012/06/less-is-exponenti... [1] https://nim-lang.org/docs/manual.html https://nim-lang.org/docs/manual.html
- nimmer 6y agoAmong other things, Nim is programmable using templates and macros and very powerful at that. Also it's faster than Go on most benchmarks.