In an earlier post, I shared a nearly-3-hour YouTube video of someone live-coding Rust that really brought me into the language. I’ve found another video that’s gotten me excited. I mentioned on Twitter I had seen yet another fantastic talk regarding Rust given by the always energetic and entertaining, Bryan Cantrill – this one from Scale in 2018. This is an awesome presentation where he starts off with a theory about values in software and languages and then demonstrates, in my mind, how capable Rust is of taking over the Systems Programming world. In his presentation, Cantrill selects what he views as the most obvious Rust language values.
For fun (and to clear up my own separation-of-values definitions), I thought I’d take the values Bryan ascribed to the Rust language and research them for a fuller understanding.
The Rust Language Values
is being able to create from existing structures and software; often combining multiple parts to build a more complicated part. So, think of enums, structs, traits, and library crates (“software reusability” is included here). There was actually a Medium article by Pyry Kontio arguing for a long-range plan of setting composability as the grand theme of 2021 Rust development. Kontio also argues that Rust is already “one of the most composable languages”, so the 2021 goal would simple be to “polish” what is already there. Also check out this more generic article by Joel Jakubovic on Composability and Compositionality.
according to Daniel King in his article Writing Expressive Code, is “how well the code expresses the intent of the programmer to another human who is reading it”. In King’s case, he is expounding on the expressiveness of Ruby, but a “Rusty” familiar name, Steve Klabnik, was pointing out in his blog post how expressive Rust was way back in 2013!
measures “how far” and “how hard” it can be to add features or modify existing ones in your code. Extensibility is an important factor in CICD and, in fact, is touted in the article The Short History of CI/CD Tools as one of the features which has allowed Jenkins to gain such popularity and usage. The Iron web framework is an example of a Rust add-on working to make Rust even more extensible. At Go‘s expense, this blog post explores how Rust’s extensibility makes it a good language to be stuck with for the next 20 years.
describes the inversely proportional level of effort required by the user for different systems, devices, software, or products to effectively connect, communicate, and work together. Steven O’Connor from Advanced Data Systems Corporation labels this “crucial for the modern economy” in his post What Is Interoperability, and Why Is it Important?. This value actually gets a self-titled chapter in “the” book. Interoperability, especially to and from existing C code, may be what allows Rust to quietly topple C!
… programmers just can’t be careful enough. They don’t see all the places. And C makes too many places. Too scary for me, and I guess it’s fair to say I’ve programmed C only about five years less than Ken has. We’re not in the same league, but I have a long track record with C and know how difficult it is and I think C is a big part of the problem.Bernie Cosell, quoted from the book Coders at Work written by Peter Seibel, in a blog post Notes on “Coders at Work” by Volkan Yazici
Rust has it right on the “top-fold” of the main page: “Rust’s rich type system and ownership model guarantee memory-safety and thread-safety — and enable you to eliminate many classes of bugs at compile-time.” Obviously, system integrity is a keystone value of Rust.
is another of the Rust language values right on the main page: “Rust is blazingly fast and memory-efficient: with no runtime or garbage collector…”. Everyone knows what performance (or the lack of) can do to your company, your customers, and your sanity. Cantrill has been drawn into the fray of comparing Rust and C performance, which I won’t join in on. Just try some honest comparisons for yourself.
has definitions that might sound unwanted in your coding language: “harsh inflexibility in opinion, temper, or judgment” and “the quality of being unyielding or inflexible”. However, try looking at that from a software point-of-view: “the quality or state of being very exact, careful, or strict” which correlates to “reliability, verifiability, maintainability”, etc, etc. Many jokes abound regarding arguments Rust coders have with the compiler, but that strictness of the compiler is worth it, according to a recent Infoworld article.
is another easy one for Rust. For instance, Rust requires defensive programming by failing to compile if you fail to match all of the possible patterns that can return. Dmitriy Kashitsync concludes his Medium blog post, Why Rust? with “Rust is becoming one of the most advanced mainstream general purpose languages that may be successfully used to write robust, secure, and efficient programs” [emphasis added].
is, again, where the picky Rust compiler exerts great will to make you a better programmer. No one can refute the dangerous memory problems you can get into with non-perfect C code. For instance, Will Crichton explores this in Memory Safety in Rust: A Case Study with C. That same December 2018 Infoworld article from earlier labels the Rust language “safe” right in the article’s title.
is yet another Rust language value no one needs defining. Sergey Davidoff, posting on behalf of the Rust Secure Code Working Group had Security as Rust 2019 goal. Time will have to prove how effective they are. The essential Rust book has a section devoted to Unsafe Rust and, the more advanced Rustonomicon is largely a book on the “unsafe” keyword. People are anxious to try and prove (or disprove) just how safe Rust forces your code to be. For example, RustBelt: Securing the Foundations of the Rust Programming Language. Obviously though, safety is a key concern and value of the language and of that strict compiler.
With those values, where can we go?
Cantrill points out that there are plenty of applications and operating systems on the trash heap that opted to chose other values over performance when forced to, and lost the race. C, he explained, has won over the decades because of the power AND despite the shortcomings the language provides. Daniel Angel recaps some of the category winners that are written in C in After All These Years, the World is Still Powered by C Programming. Rust is starting to change that – just see a sampling of who is using Rust in production already.
Note: after a link indicates the link is an Amazon affiliate link