Looking into Rust

Rust is a programming language that was started around 2014 by a Mozilla employee as a private project; its inventor managed to convince the Mozilla foundation to make it an official project, and in recent years, Rust has consistently ranked top as the language most liked by developers. It competes with Go in their joint attempt to de-thrown C/C++ as the standard language for highly performant systems programming.

The reason I got interested in Rust is because it uses strong static types and type inference. Its notation inherits some elements from the functional language ML, which is close to the mathematical notation for functions, and that in turn makes the code easy to read, e.g.

fn calculate_length(s : String) -> (String, u64) {
//.. return a tuple of a string and an unsigned 64-bit integer value
}

Ownership and Explicit Ownership Transfer

Unlike Java, Python, LISP or Go, Rust doesn’t use garbage collection. Unlike C, it also does not use explicit malloc() / free() calls, which have been difficult for developers to keep track of an a source of bugs, crashes and security vulnerabilities. So how does Rust do it?

Basically, a (non-atomic) object that leaves the scope (function, block) gets released, unless an explicit ownership transfer is demanded. References are excluded from needing ownership to reference an object, as are slices, which are contiguous ranges of container elements:

let s = String::from("hello world");
let hello = &s[0..5];
let world = &s[6..11];

For more detail, consult:
https://doc.rust-lang.org/stable/book/ch04-01-what-is-ownership.html
Rust’s compiler can also figure out at compile time when there is a chance of a dangling reference. In the words of the language manual:

“The Rust language gives you control over your memory usage in the same way as other systems programming languages, but having the owner of data automatically clean up that data when the owner goes out of scope means you don’t have to write and debug extra code to get this control.”

First experiments with Rust

Downloading and trying the rustc compiler via the cargo build system command turned out to be easy. Libraries specified as dependencies (“crates”) automatically get pulled from the Rust repository, a far cry from the effort it takes to install/build basic C++ libraries that are not header-only. The Rust compiler’s
error messages are readable, they localize errors well (not hard to do better than GNU g++ on that front) and the use of colour coding distinguishes source code fragments from the error messages proper in human-friendly ways.

The Crux

The litmus tests for a new programming language are stability, community and libraries. Without a stable syntax, serious developers quickly shy away from
investing their time and making a production bet seems to risky. Without a thriving community around a language, the continuity of development tool development, library development and general problem solving are in jeopardy (you want to be coding in something so that you can find the solution to your problem on StackExchange, really). An without available libaries that provide GUI frameworks, logging tools, regex engines, database abstraction layers, CSV readers, vizualization toolkits and other daily needs (some general, some depending on your area) your productivity will be reduced by the distraction of needing “just one day more, I need to quickly implement a hashtable library”.

I may return with a report of my Rust story after gaining a bit more experience, and after finishing reading the manual.

Learning to Rank Tutorial and QuickRank

Franco Maria Nardini, one of the SIGIR’19 Learning to Rank tutorial designers and presenters, kindly shared these links in subsequent communications, which are going to be helpful to anyone interested in learning to rank.

I can highly recommend these, especially the tutorial materials (4) and QickRank (2), which is implemented in ISO C++, compiles beautifully with cmake, and is a pristine example of a well-engineered and easy-to-use software tool.

1) http://rankeval.isti.cnr.it/
2) http://quickrank.isti.cnr.it/
3) http://learningtorank.isti.cnr.it/
4) http://ltr-tutorial-sigir19.isti.cnr.it/