4 ms·
That's why I started using it. But Nim is much more than just this, it's more like "We like Python, but we also like static typing, efficient and dependency-fr
by dom96 8y ago
That's why I started using it.
But Nim is much more than just this, it's more like "We like Python, but we also like static typing, efficient and dependency-free programs, super easy C/C++ FFI and metaprogramming. We also like to write all our software in the same programming language so we compile to JavaScript" :)
- wuschel 8y agoHow is the concurrency story with Nim. I know that this is a repeating question, just wondering how well it works and how safe it is. I am still eyeballing Pony-lang for it's design choices, but development seems to have slowed down there.
- dom96 8y agoConcurrency is achieved via async await. For parallelism each thread has its own GC so that makes things a lot safer, but sadly less efficient if your algorithm wants to share data between threads a lot (you can copy data between threads). You can also allocate shared memory but that's considered unsafe, this will hopefully be improved in the future. As for how well this all works, well, I recently implemented a high performance parallel HTTP server [1]. It's currently hosting the Nim Forum[2] and has been doing so for the past few months. Also it's proving very performant[3]. 1 - https://github.com/dom96/httpbeast https://github.com/dom96/httpbeast 2 - http://forum.nim-lang.org/ http://forum.nim-lang.org/ 3 - https://www.techempower.com/benchmarks/#section=test&runid=b9d29130-bd5a-4c2a-829d-352613d03cd2&hw=ph&test=plaintext https://www.techempower.com/benchmarks/#section=test&runid=b...
- wuschel 8y agoMany thanks for the detailed answer & ref.links.
- michaelsbradley 8y agoIt would be amazing if Pony Lang's[+] concurrency model could be realized in Nim, or if Nim could be extended as a language to optionally and cleanly support it. That's easier said than done, of course, since Pony's concurrency model is deeply wedded to its type system ("reference capabilities"). [+] https://www.ponylang.org/discover/#what-makes-pony-different https://www.ponylang.org/discover/#what-makes-pony-different
- spooneybarger 8y agoWe are still going strong in Pony land. There an ebb and flow to publicly seen development.
- mcintyre1994 8y agoThe writing style in your documentation is awesome! I haven't come across Pony before but it looks really nice, definitely going to give it a try. :)
- ilovecaching 8y agoThis is literally Go, save the fact that it compiles to WA instead of JS.
- jensvdh 8y agoGo is nowhere near as expressive/high-level as Nim or Python. The learning curve is significantly steeper.
- Fukkaudeku 8y agoExcept Nim doesn't make you copy/paste constantly.
- k__ 8y agoOr write code gens, haha
- kevin_thibedeau 8y ago> This is literally Go, save the fact that it compiles to WA instead of JS. Except Nim compiles to C and JS, no official WASM yet (though you can Emscriptenize the C output). Nim has macros, generics, inheritance, exceptions, deterministic GC, and more. Otherwise, yeah, exactly the same.
- ilovecaching 8y agoI was responding to the comment... the things they mentioned are available in Go. You're taking my comment out of context.
- TylerE 8y agoIt is literally un-go. Great support for meta programming and generics, and actual non-foot gun error handling
- qaq 8y agoIt's way nicer than Go (features and syntax) tooling and libs are not as developed obviously.
- jhasse 8y ago> super easy C/C++ FFI There's a HUGE difference between a C FFI and a C++ FFI. I doubt that Nim makes the latter easy (name mangling, exceptions, STL, ...).
- dom96 8y agoYou're very right to doubt me. But it does make it easy, Nim compiles to C/C++/Objective C (exceptions are mapped to C++ exceptions in C++ mode). This gives it the ability to wrap all C++ libraries, Nim takes advantage of this to make wrapping easy, here is a (very) barebones wrapper for sfml as an example: https://github.com/dom96/nim-in-action-code/blob/master/Chapter8/sfml/sfml.nim https://github.com/dom96/nim-in-action-code/blob/master/Chap...
- jhasse 8y agoThanks for the link, I stand corrected! :)