Learning Rust

Many programmers like learning programming languages. It’s fun to discover new concepts and possibilities and to be able to use them to write more elegant, more powerful or more efficient programs.

I had enjoyed this activity too, until I discovered Common Lisp many years ago. Once I learned Common Lisp, my passion for learning new programming languages disappeared. Common Lisp is so powerful that there is little to discover elsewhere. Learning new programming languages is no longer about discovering new worlds for me but rather about necessity or pragmatism.

Still, I have recently learned two new programming languages despite no immediate need: Rust and Haskell. I’ll write about my Haskell experience in another post, let’s talk about Rust now.

Why to learn Rust? Because it’s a C replacement done apparently right and getting quite popular. It’s safe, it’s safe, it’s safe, it’s much more powerful and easier to use, while it still produces very efficient code and is well suitable for system programming, IoT, etc. Unless object oriented programming is really needed, Rust can also replace C++: again, it’s safe, simpler (in a good sense) and easier to use. It’s also superior to Go in all aspects except for garbage collection. As Rust closes some remaining gaps, it should be a good fit for low to mid-level programming and it’s likely to become mainstream in certain specific and important areas. It’s good to be familiar with it.

It’s also important that Rust provides sufficiently powerful, although cumbersome, macro systems (yes, several ones, which is apparently workaround for the macro-unfriendly language syntax). This allows compensating for missing features in the language. It is actually used this way and prevents the language from becoming bloated or obsolete easily.

Rust was easy to learn. There is a very nice introductory documentation (especially The Book), the compiler is the most helpful and beginner friendly one I’ve ever used and there is a good integration with Language Server Protocol. Well, there are also some obstacles, most notably getting used to lifetimes, especially when being used to use languages equipped with garbage collection, but this is not a big issue.

There are also not so good things about Rust. The language is not very complete and relies on third party libraries to add missing features (for example, I had to use itertools, lazy_static and paste in my first Rust program to get the needed features). The language is also still significantly evolving, sometimes motivating library authors to use the newest features and requiring very recent versions of the compiler. The Rust ecosystem also follows the infamous modern trend of relying on a heap of libraries and the related dependency hell rather than having a curated standard library covering the most common needs. Haskell is better in all those aspects.

I’m also not much happy about the messy strings and CamelCase (fortunately used only in CapitalizedIdentifiers but still annoying).

Overall, Rust looks promising to me and I expect its growing usage in certain areas. I’m going to keep eye on it.


Posted

in

by

Tags:

Comments

One response to “Learning Rust”

  1. […] it’s more difficult. There are good things and not so good things. As I explained in my previous post, I’m strongly influenced by Common Lisp. If I weren’t familiar with Common Lisp, I would be […]

Leave a Reply

Your email address will not be published. Required fields are marked *