DEV Community

[Comment from a deleted post]
Collapse
 
nepeckman profile image
nepeckman

I'm going to throw Nim into the ring. Its not as popular as Rust or Go (and lacks the corporate backing) but it really is a jack of all trades language. More powerful than Go (macros, generics, and sum types), and way easier than Rust (Garbage Collector, more forgiving compiler without the borrow checker). It compiles to a static binary for all operating systems, has easy C interop, has a JavaScript target with easy JavaScript interop. It has a nice syntax that feels like a scripting language, but static types. Its really fast. It can do native GUIs, CLI tools, web apps. I can't recommend it for corporate use (yet!) because it hasn't hit the 1.0 release, but its been my hobby language for a while now and I've really enjoyed it. I came to it from a JS heavy background, let me know if you have any questions!

Collapse
 
lyfolos profile image
Muhammed H. Alkan • Edited

I have tried it, it's fun first days, but it's getting boring by the day. I'm still waiting for the first stable release of Nim. It's a nice language.

Collapse
 
sergio profile image
deleteme deleteme

Wow that all sounds too fantastic. What's the catch?!

Collapse
 
nepeckman profile image
nepeckman • Edited

The catch is the small community. The community is active and committed, but the lack of a large sponsor like Google means that not many people have heard of the language. There are a good number of packages and libraries, but its a far cry from the JavaScript world where you can npm install anything and everything. Documentation can be lacking at times, but fortunately the community is pretty helpful. If that isn't a deal breaker (and I totally understand if it is), its really worth looking in to. If you're interested, I can link some introductory material, and I'd be happy to explain the basics!

 
sergio profile image
deleteme deleteme

Please share that intro material. I'd love to dive into this language over the weekend.

 
nepeckman profile image
nepeckman

The best text is Nim in Action which includes a twitter clone tutorial, cli chat tutorial, and all the best Nim tips. Unfortunately, its $40, so its not exactly low commitment.

The official tutorial isn't bad, but lacks the practical examples of the books. The manual is dense, but contains everything about the language. Installation is pretty easy. Most OS package managers have a nim package and choosenim (like Node's nvm) has an easy install script. The standard library is pretty big, and contains a lot of good packages like HTML generation, JSON parsing, http server, etc. The Nim package manage is called nimble if you want to look at what user created libraries are out there. I grabbed most of these links from the documentation page, which includes other more specific guides like compiler flags and C/JS interop. Can't forget the github page which includes links to a forum (which is open source and written in Nim), as well as Gitter and IRC for real time chats. The github wiki has a nice guide on editor support, most people are using either VS Code or Vim.

And that concludes my link dump! Random bits of advice: seq behaves like JavaScript's Array, except it has a static type. I tend to use reference objects, as all JavaScript objects are references and I'm most used to that. You can import the sugar module from the standard library and get arrow function syntax if you like arrow functions. sequtils and strutils have all the array modification and string modification that you need. var is like JavaScript's let, and let is like JavaScript's const. Nim also has const which is a compile time constant for when you want something to be even more constant. If you want a sum type, Nim's is called object variant. I ignore all the inheritance stuff because sum types are usually sufficient. Hope this paragraph was somewhat coherent, and I'm happy to expand on anything!

 
jay profile image
Jay

I've been tinkering with Nim for a while, but never encountered sugar. Thank you for that.

Collapse
 
rhymes profile image
rhymes

Great suggestion!