Anyone have experience using Nim? The TLDR that I am seeing is compiled portable python/js replacement in a way.
I was thinking about trying to write a webserver with it and was wondering if anyone had any previous experience with it.
No experience yet, but It’s the next language I want to try.
In my experience, Nim is a language that you either fall in love with immediately or just try for a bit before going back to Rust or Python. My experience is the former, I absolutely love this language and I feel most people are missing out on it.
Honestly I don’t really have anything to say about it other than it’s just a lot of fun to use. It’s got a great macro system, and the compile-time evaluation is the best, imo even better than Zig. It’s also got a large and comprehensive standard library, so for smaller projects you don’t really even need to use Nimble.
But other than that, my love for this language is mostly just “I like how you write stuff and how that stuff works.” It’s a great language if you need to develop fast like Python, but run fast like C. It’s a language you can spend years learning the intricacies of, but pick up in a day. Nim was where a lot of programming concepts just clicked for me. It’s more than just a compiled Python, and I recommend playing around with it for a bit.
Thank you so much for posting. It’s really nice to hear from someone with experience first hand.
Nim is one of my favorite languages, and has been one of my primary languages in rotation for projects for the last five or so years. I’ve written servers (and web frontends, CLI tools, quick scripts, etc.) with it and am very happy with the results.
It’s hard for me to put into words why I like it so much, but I think it might actually be because it’s such a mishmash of paradigms. If I’m in a functional mood, I can use lots of ideas from functional programming. If I feel like using OOP everywhere, I can do that too. And if I want to mix both together, it’s no problem! Nim kind of feels like the Wild West, and while that’s something I’d dislike in most languages, for whatever reason it works when writing in Nim.
Nim is cool. Easy to read python-like syntax, strongly typed, compiles (not transpiles) to C, so you can use common C tools like valgrind, gdb, musl, etc.
Small footprint, devel version supports deterministic gc (arc/orc).
One of the greatest interops with C, C++ or JS (C and JS are not mixable, obviously)I’ve only used Nim in hobby/toy projects, but it was very pleasant experience.
@janAkali I wonder how it compares to compiling Python code with https://github.com/Nuitka/Nuitka , which is a real compiler using C and not just a bundler. To me, from programming language perspective Nim looks like an improvement for the developer. Here is a nice overview: https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers , but this does not take Nuitka into account.
First time hearing about Nuitka and it sounds promising for Python devs. But from a quick glance it is merely an AOT compiled Python.
For me, Nim has big advantage over Python: types that are statically checked at compile time.
Types make you reason about your code more. Good LSP uses types to suggest you code without any AI and shows you errors before you have to run your script/programm.
I’ve been using it for 2 years or so, mostly for hobby programming, and I really love it, it’s been great for the kinds of things that I do at least :) Feels great and logical to write, and it’more or less works the same way my mind does, the type system is really good think something like Ada, and it can be both a pretty low level, and high level langauge. YMMV, but I really like it personally.
I prefer Rust but I am jealous of
comptime
.I’ve been using a little, learned at the start of the month and really enjoyed, but since it don’t have many user sometimes is hard to find how to do something, it was easy to create a webserver but i really wanna to create a qt application with it (since i use kde plasma), but i can’t find a proper way of doing it
Maybe try some of these - I found this awesome list in my research https://github.com/VPashkov/awesome-nim#gui
Oh thank you, this might work and i will also bookmark the list too
I like Nim and many concepts of it with the big point of discussion being that function names get normalized (helloWorld === hello_world).
But I feel like that Nim is a language without purpose. It’s all nice and cool on paper, but it has no use case where I think “I have to do it in Nim”.
Go is known for making small, fast startup web apps, Python for making small one time tasks or Data work, Rust low level programming if you like functional programming, PHP if you want yo setup a website as fast as possible.
But Nim doesn’t have this, it doesn’t have a library that’s better than in all other languages. It’s nice but what for?
I have to disagree with your “when use what” list. Python has production ready web backend frameworks, Rust is perfectly fine for complex and high-level software, and PHP is mostly obsolete. That’s my humble opinion though. I looked into Nim and like many of the concepts. It’s quite complex and I prefer Rust most of the time when Nim would be an option. I’d argue it’s some kind of “jack of all trades”. A bit like python but compiled, ref-counted, and probably a lot faster. It’s lacking the huge community python has though.
It’s lacking the huge community python has though.
And where did Rust, Python etc get their huge community from in the first place? From being jack of all trades? No, because they were the best fit for their use case. After they established themselves there, they became widely good.
I’ve never been a big fan of transpiled languages. I’ve looked at Nim a few times over the years and while it looks nice, I’ve never found it more compelling than other languages. Chances are there is at least one more not quite mainstream language that does something cool that will fit your usecase more and not be transpiled.
Nim is not transpiled. Transpilation means translation between equal levels of abstraction. The C code generated by Nim is not something most people would do anything with.
IMO going from one programming language to another is the same level of abstraction regardless whether the target language is closer to the metal or not. If Nim compiled to assembly or some byte code, that is a lower level. I can’t say that I’ve ever wanted to do anything with the output of a transpiler aside from just send it on to the next stage. I’ve never seen any machine generated source code fit for human consumption. Even typescript produces a lot of boiler plate that would not be pleasant to try and maintain.