3 ms·
> What does Nim do better than any of these? Metaprogramming, and it's not just about how powerful it is. Metaprogramming in Nim is easy, safe, and powerful.
by dom96 10y ago
> What does Nim do better than any of these?
Metaprogramming, and it's not just about how powerful it is. Metaprogramming in Nim is easy, safe, and powerful.
You mention a lot of extremes: Go is simplest, Rust is the most safe, C++14 has the best execution performance. These extremes have trade-offs: Go's lack of generics mean that you end up writing a ton of unsafe boilerplate code, Rust's safety means that you have to spend extra time wrapping your head around lifetimes, C++'s best execution performance means that you have to deal with memory manually and in an unsafe manner.
These trade-offs are debatable, but my point is this: what if I want a language that is well balanced? Nim may not be as simple as Go, but it's definitely simpler than C++ and Rust. Nim may not be as safe as Rust, but only when you decide to manage memory manually, which is rarely necessary and when using Nim's GC it is just as safe as Rust. Nim compiles to C/C++ so its performance is identical in many cases.
The initial idea behind Nim was to have a small core language with a powerful metaprogramming system for expansion. Perhaps we have strayed from this vision a little bit, but it is still true. And we do aim to refocus towards it.