DEV Community

Discussion on: JavaScript Frameworks: My Thoughts

Collapse
 
hkgx profile image
Hubert

nim? how are you supposed to use it in webdev?

Collapse
 
juancarlospaco profile image
Juan Carlos

Nim compiles to JavaScript and WebAssembly for Frontend, kinda like Svelte.

Nim compiles to C for Backend, kinda like Rust but with Python syntax.
:)

Thread Thread
 
hkgx profile image
Hubert

yeah, but I think that Nim is a bit too low level for such things.
also: does rust compile to c? thought that it's totally standalone.

Thread Thread
 
juancarlospaco profile image
Juan Carlos • Edited

Nim is quite the opposite is very high level,
Types are better than TypeScript types,
code is easy to read like old CoffeeScript,
code is high level usually takes less lines of code than Python,
Nim Metaprogramming can help make stuff really friendly at high level while keeping it efficient at low level and very expressive to write.

Nim Backend Hello World:

routes:
  get "/":
    resp h3"Hello World" # <h3>Hello World</h3>

Nim Frontend Hello World:

setRenderer (proc (): VNode = buildHtml(tdiv): text"Hello World") # <div>Hello World</div>

Rust compiles to LLVM IR. LLVM IR is from another different project.