4 ms·
Rust for Node developers
- Yhippa 10y agoAfter using Firefox for the first time in forever I noticed that I'm liking a lot of what Mozilla does to try to educate people on web development practices. I am curious as to how others find Rust to use in practice. Looking to augment my knowledge in Java with another language that's quite different.
- deleted 10y ago[deleted]
- ilaksh 10y agoDidn't really see a ton of substance in that, it seemed to mainly add up to a long-winded explanation of printing out a text file using two different languages in convoluted ways. Here is my much shorter version of basically the same thing with a different language: Nim for Node.js Programmers I love Node.js programming, especially because of the massive ecosystem of modules available, but Nim has some advantages in many cases. Here are three: it uses very little memory, creates code that is very fast, and interfaces extremely easily with C and C++. ### Node.js How to set up Node Since you are a Node programmer, you already have it set up. const fs = require('fs'); fs.readFile('hello.txt', 'utf8', (err, data) => { if (err) { console.error('Problem reading file:', err); } else { console.log(data); } }); How to set up an editor/IDE Since you are a programmer, you already set it up. ### Nim Install Nim -- thoroughly explained here: http://nim-lang.org/download.html http://nim-lang.org/download.html Enter into readfile.nim: try: echo readFile("hello.txt") except: echo "Problem reading file." Run command 'nim c readfile.nim' then './readfile' ### Package Management in Nim The `nimble` command handles packages in Nim. Please read the excellent and thorough documentation here: https://github.com/nim-lang/nimble https://github.com/nim-lang/nimble For more information, see the great documentation at http://nim-lang.org/documentation.html http://nim-lang.org/documentation.html, the new book Nim in Action, https://www.manning.com/books/nim-in-action https://www.manning.com/books/nim-in-action, or many other resources online such as those listed here: http://nim-lang.org/learn.html http://nim-lang.org/learn.html