💾 Archived View for tilde.pink › ~kaction › log › 2018-10-22.1.gmi captured on 2023-06-14 at 14:38:50. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
Recently, I decided to learn Rust programming language and even implement some not too ambitious, but real project in it. I had two reasons for it:
So, let's begin. As usual, if you can't `apt-get` it, either it does not exist or does not deserve attention. In case of rust, everything is there:
# apt-get install rustc cargo rust-doc
After that, one can browse file:///usr/share/doc/rust-doc/index.html, and start learning either by tutorial, either by series of examples. Standard library reference is also there. Unfortunatelly, documentation is typeset rather poorly; I was forced to use graphical browser.
file:///usr/share/doc/rust-doc/index.html
Rust position itself like very safe C, but with high-level abstractions, like algebraic data types and type inference to make programming comfortable. It feels like C++ done right.
Well, not everything is impeachable. For a language, that claims to be replacement for C, simple "hello world" program, yielding 200Kb binary is, well, much.
After programming Haskell, any other language feels inexpressive, error-prone and repetive. So, if you are okay with huge binaries (tens of megabytes) and garbage collector, just use Haskell.
On other hand, if you are considering C++, or even C, maybe it worth give Rust a shot. Beside smart idea of borrow-checking, Rust has features, that are lacking even in Haskell:
Haskell do have this option, but it is buried deep in GHC manual. It is called `-fno-code`, which is definitely not as pleasant, as `cargo check`
$ stack build $ stack build --fast $ stack build
Last command will re-compile whole project again!