Elm, Rust, and Learning a Language

Posted on May 24, 2016 by Richard Goulter
Tags: , ,

Elm and Rust are two programming languages I’m excited about (in the sense of, “wow it’d be cool to use these”).

Elm is a Haskell-inspired language for client-side web development; with a philosophical emphasis at making Functional Programming usable/accessible. – In a talk from March, “Let’s be mainstream”, Evan Czaplicki compares JavaScript (easy to write, hard to maintain) to ML (hard to write, easy to maintain): the suggestion being that this isn’t necessarily a trade-off which must be paid; but that perhaps it’s better to try and improve JavaScript than to make ML languages easier.
There’s a cool online editor environment for Elm so you can look at some examples & try the language.

Rust is a “safe C”, with many of the goodies of ‘modern’ languages like product and/or union types, tuples/records, pattern matching, etc.; its unique aspect is that “ownership” must be explicitly modelled.
For a taste, “this post showing Fizz-Buzz programs in Rust” explores various parts of Rust which you’ll encounter starting out with the language. This page showing implementing linked-lists in Rust does the same thing, exploring aspects of the Rust language while programming a fairly familiar data structure.
Rust by Example lets you edit & run each of the code snippets.
Andrei Alexandrescu (guy who coined the term “modern C++”; architect of the D language) wrote an answer on Quora where he compared D, Go and Rust as “C/C++ replacements”. The criticism of Rust is whether it’s worth all the extra effort to model ownership. (On that note, D v Swift v Rust would be interesting; maybe also Scala-Native if that comes to fruition..; Go is cool & all, but relates more to Python/Ruby).

One thing both of these languages have in common is “great error messages”. (e.g. “Compiler Errors for Humans”, Rust’s compiler will try to explain what was wrong / suggest a solution). – One might say that because these languages are so out of wack from your typical blub language that the compiler needs to explain its errors, ha; but I’m more likely to think that reading compiler error messages is strange, … because I’m used to reading compiler errors as “nope” then checking the guilty line to figure out what’s wrong.


These posts about Elm and Rust are interesting and all, but there’s also a limitation to them. You certainly get a taste for the language, (& certainly there’re differences to these languages that you’ve to pay attention to these things); but there’s also a step between “playing with the language in online environment” & being able to run the examples on your computer.
’cause when someone says they “know Java”, they don’t just mean the Java language, but some familiarity with some JRE library packages, how to setup a development environment for Java, how to setup projects in Java (e.g. in Ant, Maven, Gradle or whatever).
– I guess newer languages ought to benefit from how older languages have been developed. So you get tools like elmenv or elm-format, rustfmt, in addition to decent platform tools like Rust’s cargo.

I think what’s not immediately obvious is how to pick up & use these languages for tiny projects.
Python is my go-to language for quick scripts where I just wanna scratch something together. It’s not that these aren’t “programs” or “projects”, but I don’t wanna worry about setting up any kind of package-file, nor freezing dependencies, etc.
– I don’t necessarily doubt that it’s possible to quickly get something together in Elm or Rust in the same way; but I wonder if this baggage of “things a $LANGUAGE developer knows how to do which a newcomer doesn’t” couldn’t be more obvious to pick up.


Newer post Older post