DEV Community

Discussion on: Nim v. Rust

Collapse
 
juancarlospaco profile image
Juan Carlos • Edited

Other differences can be:

  • Nim has inheritance, Rust has no Inheritance.
  • Nim has template, Rust do not have that.
  • Nim can generate Hardened Binaries easily, Rust can not (at least as of today, in proper way).
  • Nim can generate identifier names with backticks (like Kotlin), Rust I can not find a way to do it easily.
  • Rust has better Marketing, but enforces Trademarks on name and logo.

Lots of Rust dev still depend on NodeJS to do Frontend stuff (I know Rust can do WASM),
but still for some reason, a lot of people still depend on NodeJS and TypeScript,
if thats a Pro or Con, is opinionated, but I prefer to not fight with node_modules, etc.

More idiomatic Nim can be:

func factorial(n: int): int =
    if n == 0:
        result = 1
    else:
        result = n * factorial(n - 1)
Enter fullscreen mode Exit fullscreen mode

Mainly the return type, I would add {.inline.} if was my code :P

Good comparison, nice post, I think you have more experience with Rust, both awesome languages.

Collapse
 
aachh profile image
aachh

Hey! Thanks for replying.
I do agree, the other differences you pointed out are key. I actually mentioned the identifier with backticks trick as stropping, turns out that's what it's officially called.
About the func vs proc—I don't know how I could forget about that. I'll actually edit the post for this.
I actually do not have more experience with Rust; I know both of them moderately well, but know a lot of stuff about them.
Really, thanks for replying, it means a lot!