home | tech | misc | code | bookmarks (broken) | contact | README

Some opinions of mine on some programming languages

Rust Programming Language

Why I'm trying Rust


This section used to be named "Why I chose Rust". I'm trying it and I'm not sure if I will stick with it!



This article is a working in progress. As I study Rust it can change a lot without advice or notes in this page (this is not a blog). If you want to track this page changes, follow this site in github.


Last update: 2017-04-15.

I'm starting a new personal project that will probably span two years. I wondered what language should I try it. I program well in C, Tcl, Java and sh I believe and I have done some things in C++ (pre-C++11, with Qt), Python and PHP.

This new application will have to be very responsible. From experience, none of the garbage collected languages can meet my requirements. I was interested to learn some new languages like Go, Rust, Erlang, Haskell and OCaml. After some research I decided that the only languages that could match requirements (and tastes!) was C, C++ and Rust.

The research

I've read a lot of links and debates on the web (links in the Good articles to read section). Besides the system language requirement (not garbage collected, fast and still allowing direct access to the memory) it would be good if I have most cross-platform development support. Although I love C, it is probably one of the languages where cross platform is tougher. Because of that and because object orientation features would be really useful, I soon put it aside.

The choice was between C++ and Rust. On my research I found a lot of debates, most of them advocating Rust and almost none criticizing it, with exception of the famous Criticizing the Rust Language, and Why C/C++ Will Never Die, which is a nice article, but a few outdated.

Because of that, I decided to make a list of features that I like and dislike in it and write some more stuff to help wanderers chose the right language for theirs problems. I would call the list "Pros and Cons" but since it is an opinionated list, I prefer to call it "What I like and dislike in Rust".

What I like in Rust

(To be completed)

Safeness by default

Immutability by default

Nice syntax. Fun to write in.

No Exceptions. Option<T> and Result<T, E>

High level abstractions

Types with unambiguous size in their names (e.g. i32 versus C's int)

Modules and how they relate to the project filesystem hierarchy

What I don't like (or don't understand) in Rust

(To be completed)

No polymorphism

No tail call optimization

Yes, it is complicated, but could it be different?

Box, Rc, Arc, RefCell, Mutex, etc. Lot of different smart pointers, but could it be different?

Other considerations

I don't think Rust and C are not competitors, even though Rust creators argue that. C is "(...) basically one layer of abstraction above assembly" (link). New C standards don't try to change that and just try to make syntax less cumbersome (like C99 struct initialization). For me, the proximity to assembly is, at the same time, one of the most important things of C, its weakness and its strength.

But I think Rust and C++ and true competitors. References to C++ are common in Rust debates and both try to solve similar problems. Both have object orientation (although in Rust it is somewhat different), a portable standard library (although small), new C++ standards have brought ownership and lifetimes solutions. In summary, Rust and C++ are tools for the same kind of problems.

Good articles to read