I keep hearing about Nim and it sounds interesting, but I'm not sure I have the mental capacity right now to do a deep dive into the language and build something with it. I'd like to at some point soon though.
I keep hearing about Nim and it sounds interesting, but I'm not sure I have the mental capacity right now to do a deep dive into the language and build something with it. I'd like to at some point soon though.
I like it. For me, it started out as a faster python that prevents typos. But it has really grown on me. I really like that I can share libs on server (compiling to c) and client side (compiling to plain javascript).
Basically any C library is also a Nim library with a tiny wrapper. That's a huge ecosystem! I also like how Nim can integrate with complex C++ libs that do virtual table call backs. It can also call objective-C functions .. you know the ones with [foo a:1 b:1] crazy syntax? Python was a glue language for me, but Nim can just glue more things.
JS too! In Nim you can just compile to plain JS, that other JS can call as well. Pass plain JS objects around. I basically replaced my JS code file by file - there was no need for a huge rewrite.
I know docker and kubernetes is "the thing" right now, but I just like that I can just scp the binary over. It just feels less complex. I feel like docker solved the distribution problem for python and node... I just don't have a problem to solve any more. It's just gone.
I'm also working on a game that I haven't quite moved to iOS/Android yet, but that is my plan. So far targeting the desktop with SDL and HTML5/Canvas with the JS backend works very well.
Does not appear to be any harder then sharing C or C++ libraries.
Do you use it in Pushbullet?
1) Its really easy to get started with. The default runtime has a GC for memory management, and the typing system is pretty similar to other popular languages. You can pick up the syntax in a day, the basic semantics in a weekend, and the more advanced semantics in a month.
2) Its fast and reliable. If the code compiles, it probably works, and it's probably a tier faster than a scripting language. Maybe not as bulletproof as Rust, but the ease of use is worth it for me. It can even reach C speeds, but that does require some advanced knowledge. Again, the default runtime is probably fast enough.
3) Powerful language features. I know there are a lot of people out there happy using C. I'm glad that works for them, but features like case objects, generics, and closures are part of the abstraction tools that I use to get stuff done. Nim also boosts what might be the best macro system for a static typed language, which is very helpful for framework developers.
It's a fairly small learning curve to be honest, especially if you're familiar with reading Python.
What I love about it is the small binaries.
I wouldn't choose to use it in production, mostly because of the developer experience. The documentation and tooling are both pretty bad, and the compiler errors can be arcane (especially when using generics, or when the error only surfaces during C compilation).
What doc issues are the biggest pain points for you right now?
(Getting good error messages for macros and meta-programming is notoriously hard, but we are trying!)
Edit: Email me if you'd like more info.
The biggest downsides right now as compared to Python are the overall lack of libraries, and lack of documentation (the core language is reasonably well documented, 3rd party libraries much less so).
As for the "mental capacity" I felt the same about finally getting into Rust. Spending some time with Nim actually helped me bridge the gap from Python to Rust.