Starbeamrainbowlabs

Stardust
Blog


Archive


Mailing List Articles Atom Feed Comments Atom Feed Twitter Reddit Facebook

Tag Cloud

3d 3d printing account algorithms android announcement architecture archives arduino artificial intelligence artix assembly async audio automation backups bash batch blender blog bookmarklet booting bug hunting c sharp c++ challenge chrome os cluster code codepen coding conundrums coding conundrums evolved command line compilers compiling compression conference conferences containerisation css dailyprogrammer data analysis debugging defining ai demystification distributed computing dns docker documentation downtime electronics email embedded systems encryption es6 features ethics event experiment external first impressions freeside future game github github gist gitlab graphics guide hardware hardware meetup holiday holidays html html5 html5 canvas infrastructure interfaces internet interoperability io.js jabber jam javascript js bin labs latex learning library linux lora low level lua maintenance manjaro minetest network networking nibriboard node.js open source operating systems optimisation outreach own your code pepperminty wiki performance phd photos php pixelbot portable privacy problem solving programming problems project projects prolog protocol protocols pseudo 3d python reddit redis reference release releases rendering research resource review rust searching secrets security series list server software sorting source code control statistics storage svg systemquery talks technical terminal textures thoughts three thing game three.js tool tutorial twitter ubuntu university update updates upgrade version control virtual reality virtualisation visual web website windows windows 10 worldeditadditions xmpp xslt

Rust: First Impressions

You may have heard of Mozilla's Rust - a fairly new language developed by Mozilla for their new rendering engine, Servo. Recently, I took a look at Rust, and this post contains my thoughts.

Please note that I am looking at Rust (a compiled language) from the prespective of an interpreted language programmer, since I have not actually learnt any other compiled languages yet.

To start off with, Rust code appears fairly easy to read, and is loosely based on other languages that I already know, such as Javascript. You can quickly get the gist of a piece of Rust code just by reading it through, even without the comments.

The compiler is easy to use for beginners, and also quite helpful when you make mistakes, although some of the error messages are definitely not friendly to a new Rust programmer. I personally got totally confused by the finer points of Rust's type system, and the compiler was most certainly not helpful when it came to sorting the problems out.

The ability to set a variable equal to the output of a complex expression is also nice - allowing you to do this:

fn main() {
    let x = 2u;

    let y = match x {
        0 => "x is zero!",
        1 => "x is one!",
        2 => "x is two!",
        3 => "x is three!",
        4 => "x is four!",
        5 => "x is five!",
        _ => "x is larger than five!"
    };

    println!("{}", y);
}

Rust has some nice language constructs too - the match statement above is an example is this. It looks so much better than the traditional switch statement, and is more flexable as well.

The problem with Rust, though, is that it doesn't really have very many different tutorials and guides out there for new programmers, especially those coming from an interpreted language background, like me. This will sort itself out though, in time. The language itself is also changing frequently, which makes keeping a tutorial updated a considerable amount of work. This also make the language more difficult to learn, since you can't be sure whether the tutorial you are reading is up to date or not. This problem will also gradually disappear on it's own as the language stabilises though.

To conclude, Rust looks like a promising new language that I will resume learning at some point in the future, perhaps when I have more experience with compiled languages (and type systems!), and when rust has stabilised a little more. At the moment Rust does not feel stable enough and mature enough for me to easily learn it.

Art by Mythdael