6 ms·
This might sound strange but Nim is good for everything. From writing backend services to creating web apps running on the client side. I've built emulators, CL
by dom96 8y ago
This might sound strange but Nim is good for everything. From writing backend services to creating web apps running on the client side. I've built emulators, CLI apps, a full blown forum and much more in it.
It's particularly great for systems programming tasks that require high performance and zero dependencies. For example, Status is currently writing an Ethereum 2.0 sharding client for resource-restricted devices[1] in Nim.
Nim is also awesome if you've got an existing C or C++ codebase, the interop that Nim offers is one of the best (if not /the/ best), especially when it comes to C++ interop. As far as I'm concerned no other language can interoperate with C++ libraries as well as Nim can.
1 - https://github.com/status-im/nimbus https://github.com/status-im/nimbus
- iTokio 8y agoWhat are Nim’s main weaknesses?
- dom96 8y agoThese affect people in different ways but off the top of my head: - No Nim v1.0 yet, despite this we do our best to create a deprecation path for everything that's possible. - No big company like Google/Apple supporting the language. - Community is smaller than that of Go/Rust.
- nicoburns 8y agoA biggy is that it only really has a single developer, and no big corporate users. And relatedly the library ecosystem is relatively weak. It also has a GC, so it can't be used for really low-level stuff where that is a problem. It's looking pretty promising though. Especially if you are a fan of python's syntax.
- andrewchambers 8y agoThat is not totally true. Nim's own GC is written in Nim. You can turn the GC off.
- mratsim 8y agoI use Nim for Cuda, OpenCL and cache-sensitive/memory-bound multithreaded computation. You can mix and match manual memory management and GC-managed types in the same codebase.
- interfixus 8y agoTwo developers at least. One of whom is in this very thread. It's a concern, yes, but actually has been around for more than a decade, and is showing absolutely no sign of slowing down or going into hibernation. I have just seen a ... competing language team spending developer time on purging the code of what they call ableism. apparently it's now offensive to talk of a sanity check ot to facetiously refer to OCD in a comment. At least we may hope the Nim team lacks manpower for such idiocy.
- tzs 8y agoWhich competing language team? All I found on Google was this gist of someone saying "sanity check" should be avoided. ("health check, too) [1], and some issues and pull requests in projects that were not languages. One of the latter is clearly trolling to test Linus Torvalds' resolve to be polite [2][3][4][5], complaining about "ableist/saneist" terms, including "silly", on several of Linus' repositories. You can tell it is a troll because it is just copying/pasting the exact same complaint, just changing the name of the project. It is not even bothering to change the list of alleged problematic words and their counts, so for example it is claiming that perconvert has 144 occurrences of "sanity check" when it actually has 0. In fact every single claim on that one is wrong. The only word from the complaint actually in pesconvert is stupid, which occurs one time, not the six times claimed. Second sign it is a troll is that it is from a GitHub account created just before the complaints were posted. [1] https://gist.github.com/seanmhanson/fe370c2d8bd2b3228680e38899baf5cc https://gist.github.com/seanmhanson/fe370c2d8bd2b3228680e388... [2] https://github.com/torvalds/uemacs/issues/16 https://github.com/torvalds/uemacs/issues/16 [3] https://github.com/torvalds/linux/pull/595#issuecomment-423660617 https://github.com/torvalds/linux/pull/595#issuecomment-4236... [4] https://github.com/torvalds/pesconvert/issues/4 https://github.com/torvalds/pesconvert/issues/4 [5] https://github.com/torvalds/test-tlb/issues/5 https://github.com/torvalds/test-tlb/issues/5
- interfixus 8y agoCrystal. https://github.com/crystal-lang/crystal/commit/5c2894298612bdbf53b1543ce07ef784b461d6ae https://github.com/crystal-lang/crystal/commit/5c2894298612b...
- recursive 8y agoIn this very article, which is pretty light on details, one of the few facts presented is that you can disable GC.
- skellock 8y agoAgreed. I purged a bunch of stuff and still feel like I left too much in. A couple of bonus facts for you: - they've got an effects tracking system where you can have the compiler track (and whistleblow!) which functions are pure or not - their multi-phase compiler allows you to read in source code at build time (from files or external programs!) - their macro system is typesafe as it operates at the AST level - the guy who created it will always tell you how he feels - again with their macro system... there are FP libs, pattern matching libs, and OO libs that can "literally" transform the language to fit your preference - and one more just for you: they don't support tail call optimization (ducks)
- anentropic 8y agoit sounds awesome
- antonkm 8y ago> - the guy who created it will always tell you how he feels What does this mean?
- dom96 8y agoI'm guessing, but I think the OP means that the Nim creator is a bit like Linus Torvalds. He will tell you if he feels your idea is silly, especially if he's argued against that idea hundreds of times already.
- kryptiskt 8y agoIt has no algebraic data types and pattern matching.
- andrewchambers 8y agoSomeone wrote pattern matching as a macro - nim is pretty powerful.
- mooreds 8y agoThis library? https://andreaferretti.github.io/patty/ https://andreaferretti.github.io/patty/
- andrewchambers 8y agoThat's the one.
- ColinWright 8y agoDo you have a reference for that immediately to hand, or should I search for it ...
- chi3 8y agoThis is enough to make me keep using C++ for the use cases where Nim is meant to shine, or choose Rust instead. If I'm to learn a modern language, I really expect it to support modern paradigms. I can see why it'd be interesting to someone with no C/C++ knowledge to get into systems programming though.
- mratsim 8y agoWhat algebraic datatypes is Nim missing? It has generics, tuples, tagged and untagged unions, it even has C++20 concepts.
- inportb 8y agoTabs are not allowed for indentation.
- skellock 8y agoPost author here. A few things that make me sad in the pants: - js doesn't have source maps (kinda of a big deal to me) - some error messages are head scratchers (seem to remember trying to add things to an immutable array not being clear) - docs could use love (eg seeing more examples of macros in action) - devel (their nightly compiler) can be rough (e.g. i found the "strings cannot be null" cutover a bit rocky -- my own damn fault, i can't go back to 0.18 after being on 0.18.1) - the big one I think, however, is adoption. I keep hearing "i'll just use rust or go". That's legit as they're also awesome. nim's stdlib is massive (too big?) and there's tonnes of high quality packages out there. You won't be left thinking... well, crap, looks like I need to talk to roll this redis layer myself. EDIT: Formatting. How does it even work?
- kungtotte 8y agoThe docs issue and devel being rough are both due to the pre-1.0 status and the smaller community. It's a little bit of a catch-22; you need adoption to gain contributors but people won't adopt until there's enough contributions to make it stable.
- dom96 8y agoyeah, which is usually where big companies help out. Their respect in the tech communities makes people take note of the new technology. I really really think "underdog" is the best way to describe Nim because of this.
- deleted 8y ago[deleted]
- alehander42 8y agoI have implemented source maps for the js backend : https://github.com/nim-lang/Nim/pull/7508 https://github.com/nim-lang/Nim/pull/7508 They aren't merged yet in the upstream compiler because I wasn't sure if I wanted to refactor the jsgen with them, but otherwise they are almost there: I use them in a personal project in a forked branch
- eeZah7Ux 8y ago
- singularity2001 8y agoconst hand* ^^ is that a pointer? Are we moving backwards?
- narimiran 8y agoNo, it isn't. `*` after a name means that the variable/function/type/etc. is public and can be seen/used when you import a module. So the whole expression just means "a public constant string (automatically inferred type) named `hand`".
- singularity2001 8y agooh, that was a surprise. thanks
- sushidev 8y agoHow about the garbage collector? For really performance sensitive applications you'd turn it off and resort to manual memory management?
- dom96 8y agoYes, but the GC is very flexible so you might get away with using its soft real-time features[1]. 1 - https://nim-lang.org/docs/gc.html https://nim-lang.org/docs/gc.html
- andrewchambers 8y agoNim also has a stack based region allocator, but it didn't seem too well documented when I tried to use it.
- mratsim 8y agoYou can also mix GC-managed and manually allocated types in the same codebase.
- qznc 8y agoInteresting claim. For me, D has the best C++ interoperability. Small test which D failed: Create a std::vector<Foo> in Nim. Create some Foo objects and append them. Pass the vector to C++, create some Foo objects there and append them as well.
- dom96 8y agoI think this is possible. I'm boarding a flight right now but I'll try to get back to you with an example later :)
- k__ 8y agoIs it the best? I read Rust is basically a safer drop-in replacement for C.
- sullyj3 8y agoLearning rust is difficult, and takes time. It's debatable whether it's worth it, but a learning a new paradigm (automatic memory management via borrow checking) hardly qualifies as a drop in replacement if you don't know how to use it already.