New Rust Programming Language

Mozilla’s Graydon Hoare Working on Rust

Jessica Thornsby

Sneak peek at some Rust code!

Mozilla’s Graydon Hoare is working on a new programming language, ‘Rust.’ The project’s FAQ describes the language as safety oriented, citing features such as automatic storage management and an ability to define complex invariants that hold over data structures. It will also offer layout and allocation control and static, native compilation. Although the project is in the early stages, the github does feature a code sample from the testsuite:

iter pairs() -> tup(int,int) {
  let int i = 0;
  let int j = 0;
  while (i < 10) {
    put tup(i, j);
    i += 1;
    j += i;
  }
}
fn main() {
  let int i = 10;
  let int j = 0;
  for each (tup(int,int) p in pairs()) {
      log p._0;
      log p._1;
      check (p._0 + 10 == i);
      i += 1;
      j = p._1;
    }
  check(j == 45);
}

The github also comes with a warning for early adopters: “This is a very preliminary work in progress. No supported releases yet nor defined release schedule / plans. Caveat emptor. It will crash. It will change syntax and semantics. It will eat your laundry. Use at your own risk.”

Author
Comments
comments powered by Disqus