Crutches


We all come to lean on our tools. Even in other disciplines I’d wager one who crafts, builds, carefully disassembles, or otherwise precisely manipulates anything relies on one’s tools. Yet, computer science seems to be in the ring with even the most tool-ridden of tinkering careers. A developers machine positively oozes tools. So much so that certain programmers have formed a kind of “tool counter-culture.” I count myself among the less extreme of their number. We constitute the software minimalists, the “purists” if you will. Of course it’s almost entirely futile to attempt to achieve minimalism in today’s internet-driven world. Most of the minimalists like myself ride on Linux-based systems which, though far smaller and less bloated when compared to a Windows system, none the less retain hundreds or even thousands of tiny GNU programs aiding them in their daily tasks.

So though I try to maintain some modicum of sanity where space and unnecessary programs are concerned, I recognize I have largely been defeated by software bloat. Firefox itself, on which I write this post, installs to almost 240MB on Arch Linux! Still, there remains hope. Some packages of software seem to have just the right parts. It all “just fits” and one doesn’t generally struggle against the machine.

Rust is one of these wonderful things. I have been working in the language since I began this project, and it’s a sublime programming experience. I loved Rust long before I began working on my ocean simulation, but I have only solidified my impression while working with Bevy. Rust has numerous advantages over other systems languages, and programmers tend to wax rhapsodic about many of them, including memory safety, the powerful type system, intuitive error handling practices, and fast compiled binaries.

I’m not going to write about those things here. They’re all wonderful, and I encourage you to read about other developers’ experiences with the language for more on those details. Instead, I’m going to talk about the tremendous convenience of the language. You see, Rust is modern. You don’t realize what a huge measure of capability and efficiency this affords until you’ve worked with something like C. I worked with C in my operating systems class. After using Rust, I hope I never have to go back. Even though I started my C journey with C++ experience, and C++ shares many syntactical details and design paradigms with C, using C99 was still a tremendous struggle. Rust, by contrast, is no struggle at all. You just (1) Install the installer, (2) run the installer, and (3) you have a working rust toolchain and can use the cargo command to create a new project. You can also use it to compile that project, install or update dependencies from crates.io (or your own corporate package repository), run the project (if it’s binary) or run unit tests (whether it’s a library or a binary). You can use it to install more sub-commands for itself so it can do more things. It’s the convenience of Node.js, but for a systems language.

Look at all the things rustup and cargo can do!

Notice something about the little info-graphic I made? There are both native and web compilation targets! Not only can Rust be compiled into native binaries on all the major operating systems and architectures, it can also be compiled into web assembly (or in Bevy’s game-engine case, compiled for the WebGPU target.) This is tremendously important for my project’s stakeholders, and it’s one of the reasons Rust was the language they settled on, but this cross-platform flexibility is also convenient for just about everyone.

When you add utilities like a language server (rls) for integration with any IDE under the sun, and the first party linter clippy, the language as a package becomes truly convenient. No longer do you have to use ninja and cmake in concert with potentially dozens of confusing config files just so you can theoretically compile on and for multiple systems. Now you can just use cargo. On everything. For everything.

When you add in the language’s other features there’s a distinct dearth of things about which I could reasonably complain. I only seem to enjoy Rust more the more I use it. Of course nothing is perfect, there’s a rather annoying bug in the core library modules for synchronized pipelines, and the documentation for the standard library and Rust itself are needlessly separate from the documentation you generate for your own crate locally. Some may find the syntax rather confusing at first too, but for the most part I find it readable and descriptive. It’s also familiar for C++ programmers, which definitely made the transition easier for me.

/// Returns `true` if this is semantically a float literal. This includes
/// ones like `1f32` that have an `Integer` kind but a float suffix.
pub fn is_semantic_float(&self) -> bool {
    match self.kind {
        LitKind::Float => true,
        LitKind::Integer => match self.suffix {
            Some(sym) => sym == sym::f32 || sym == sym::f64,
            None => false,
        },
        _ => false,
    }
}
From the Rust compiler’s abstract syntax tree token parser in v1.67.1. Find the full file at the following link: https://github.com/rust-lang/rust/blob/1.67.1/compiler/rustc_ast/src/token.rs.

In the end the language is the best I’ve worked in overall despite the inconveniences, and I’m simply grateful to have this opportunity to work in my favorite language for my senior project. Maybe I’m just leaning on a crutch, but I’ve felt much better supported in my programming!

Stay well, and I’ll catch you next time.

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *