Sunday, March 30, 2014

Rust Language Review / Predicitons

Rust is a new systems-level programming language with inspiration from Haskell, C++, and D backed by Mozilla. It has been hailed as everything from "language of the future" to "hobbyist plaything". As someone equally interested in hobbies and viability, I decided to learn Rust, with great help from #rust on irc.mozilla.org.

However, my learning experience was anything but smooth. Let me preface this by saying that I am familiar with 10+ programming languages, with at least two from every paradigm (barring logical). It obvious what snippets of other languages rust takes from, but even then it was impossible for me to write even the simplest code without asking for help in IRC.

As an educational experiment, I was trying to implement "car", a function that returns the first element of a list.

Here is an implementation of that in, say, D:
T car(T)(T[] a){ return a[0]; }
Or Haskell:
car (x:xs) = x
But what about Rust?
fn car<'a,T>(v: &'a [T]) -> &'a T { return & 'a v[0];}
Oh boy.
For a modern language, that type of syntax is frankly unacceptable. This is the part where the rust users will come out of the woodwork with their pitchforks, saying "You can't criticize it once you just started! You can't see the beauty in it!" The harsh fact of the matter is, if any beginner has to type THAT monstrosity, for something that is shorter in even Java, the language won't find wide success.

What the Rust syntax gives it is power and correctness, and those are noble goals in a programming language. They're standing on the shoulders of giants (namely Haskell) with their type system, and extending it with lifetimes, eliminating a slew of errors. But the end result is a correct program that nobody particularly wants to maintain or continue developing. It's not comfortable to work in, but it's pretty on a deeper level. So, here's the conundrum of Rust. How much usability do you want to sacrifice for functionality?

My guess is that Rust will not replace C++, but userland C in many cases. Like C, rust is a paradigm in and of itself, and it serves the same purpose that C does, but safer. But I've seen Java programmers who don't know what an interface is, Lisp programmers who don't use macros, and Haskell players ignorant to typeclasses. The beauty that makes Rust the low-level userland programming language of the future will go right over the heads of most of its prospective users.

1 comment:

  1. It is very easy to connect my two Hotmail accounts for that the user should get access of the file option after that the user should click the option “add account” that would be visible in the account information section after that the user should click on the email account button after that the user should enter the name and Email address further the user should click “next” and should get the account credentials validated, ask the technical team at +44-800-368-9064 for any further help that is needed.
    Hotmail Help Number UK

    ReplyDelete