Friday, May 25, 2012

Musings on the Rust language

I've looked over many programming languages. I was a big proponent of Fantom for some time. I still think it is one of the best languages in the Java vs. Ruby space, if you know what I mean.

In recent years, though, I've (1) gotten tired of JVM memory hogging and the need for pure-Java-hood, despite its own practicality, and (2) gotten tired of the Java ecosystem and community, especially with the whole Oracle vs. Google thing. Just tired of it. And while I still like Google, I'm not sure I trust them quite as much as I used to. Oh, and (3) related to pure-Java-hood, I've had a lot more need to interface with native code in recent years.

Anyway, I've coded much more C and C++ in recent years than I had for some time. (I've also done a fare share of MATLAB and Python, among other things, including Java.) I like playing native, but C requires so much overhead to get things right, and C++ is such a mess, despite tools like CDT in Eclipse. (Yes, I still use Eclipse despite its Java core.) I'm also just tired of header vs. source files and bother like that.

I'm also a programming language hungry sort, so I've looked at languages like Go, D, Rust, and Vala that aim to make low-level coding more pleasant and safer. I'm not sure I like D originating from a propriety land, even with open implementations, and Vala is too locked into glib land among other issues. I also buy Rust's arguments against Go's global variables and lack of automatic resource management. I also can't stand being expected to check for error responses every time. That's Go's official way of dealing with errors, although they have a discouraged form of exception handling in the form of panics. Rust also has no exceptions, but you are allowed to crash your task (coroutine) and recover from another. That's acceptable to me. That's what errors are for, really.

I also actually like functional programming despite my complaints at complicated languages like Scala. I'm not sure yet whether Rust is any better, but I think it has enough of the core things right while still being low level.

Anyway, Rust isn't what I'd design by a long shot. (The language Clay is closer in overall feel, but it's not as likely to go mainstream, and I'd actually go higher level than either Rust or Clay myself, although I'd want to retain the ability to call straight into C and maybe even C++ libs.) However, with its momentum, is Rust good enough?

I don't know, but there's a chance that Rust will become my tool of choice in the future.

Sorry no time to go into the particulars of my feelings on all the little issues.

For now, though, realize that Rust is in a heavy state of flux. That much is clear. Before 1.0 comes out, I expect a lot of things will change, and the current latest features (as for any project) risk being buggy. Documentation also lags some. Just a heads up.

5 comments:

  1. > I'd actually go higher level than either Rust or Clay myself, although I'd want to retain the ability to call straight into C and maybe even C++ libs.

    have you looked at felix? it's a functional language that compiles to c++ and can hence easily call into c++ libs. i took a brief look and was somewhat dissuaded by the fact that i could not find a single person actually using it, but the language itself looks interesting.

    ReplyDelete
  2. Thanks much for the comment.

    I ran across Felix shortly after writing the post above (if I'm remembering the timing correctly). I agree there's lots of cool in it. Other things I don't like (one example being the clever operators, as also seen in Fortress and others). For many of these languages, if the support were high enough, maybe I'd use them anyway. As you point out, Felix is still pretty lonely.

    Another language I discovered after this post was Julia. Also things I like and dislike. It has some momentum, though, like Rust. I think I'll see how things go. For now, I'm more and more a C++-er, which has surprised me.

    ReplyDelete
  3. Things have changed for the better since you wrote this post.

    Under Oracle's leadership, they made OpenJDK the reference implementation for JDK7, fixed the plug-in security issues with Java7u45+ (no longer running unsigned code + delivering server-only JRE w/o plugin as well), they also welcomed IBM, RedHat, Apple, SAP and AMD (among others) as OpenJDK contributors...

    + they delivered OpenJDK 8 as the base for JDK8, continued investment in Java and Netbeans, and included tons of goodies, including small profile Java8 and a new Javascript engine (Nashorn).

    Other issues you talk about are being addressed, like interfacing with native code via JEP191 http://openjdk.java.net/jeps/191

    The JVM languages land is fertile!
    http://www.drdobbs.com/jvm/a-long-look-at-jvm-languages/240007765

    Best,
    FC
    PS: Have you looked at NetRexx? It's been open sourced by IBM. http://www.netrexx.org

    ReplyDelete
  4. Thanks for the updates on Java.

    ReplyDelete
  5. Meant to include this link next to "tons of goodies in OpenJDK 8" http://openjdk.java.net/projects/jdk8/features

    FC

    ReplyDelete