Rust

A statically typed programming language which enforces writing code that is free from certain memory errors (use after free, dangling pointers). It’s focus on performance and safety makes it well suited for a variety low-resource domains and mission critical systems.

Rust introduces a ‘borrow checker’ which, simply stated, enforces exactly one owner for any piece of data. Data can be borrowed from the owner immutably multiple times or to only one other owner as a mutable reference (preventing use after free bugs).

In the ‘Three tribes of programming’, rust strikes a balance between hackers (performance and correctness) and poets (a programmer’s programming language)–it was designed by the poets for the hackers.

  • Finite State Machine

    A model of computation where there is exactly one state at a time of a fixed number states. The current state can be changed by transitioning to another. Using state machines has the benefit of 1) being easy to reason about what the program does e.g. security audit and 2) making obvious what a valid state is so the programmer doesn’t accidentally put into a ‘bad’ state i.e. reduce bugs.

  • Stork Is Full Text Search for Static Websites

    Stork Search is a full text search engine written in Rust that compiles to WebAssembly. That makes it compatible with static websites like notes.alexkehayias.com. The file size is relatively small (less than 1MB) for an index with hundreds of notes and the search results are fast.

  • Static Types Make it Easier Work on Projects Sporadically

    It’s easier to work on projects intermittently when a strongly typed programming language is used like Rust. That’s because becoming proficient in a codebase often entails holding the whole program in you head. Types provide mental shortcuts around the flow of data–you can skim the program by reading the static types to trace the flow of data and transformations (read the input arg types and return type) without needing to fully read or understand the contents of a method or function. In dynamic programming languages like Clojure you need to pay closer attention to what each step of the program does to anticipate what values are being used where.

  • Webassembly

    A compilation target for executing in a virtual machine supported by web browsers and servers (via tools like wasmtime). WebAssembly is intended to be portable between platforms and has a similar ‘write once run anywhere’ ethos as Java. WebAssembly already runs significantly faster than JavaScript in the browser and there is reason to believe the gap will widen as WebAssembly support improves.

  • Libraries Provide, Applications Consume

    In software development, a simple framework to keep in mind that clarifies how to write certain code is that libraries provide and applications consume. Libraries should useful and reusable in most contexts, therefore it should play nicely with other code and be more or less agnostic. Applications on the other hand are intended for end users and make different trade offs—the code is written for a user not for other code or contexts.

  • Benchmarking Results Can Be Very Different When Run in CI Tools

    Most CI (continuous integration) tools run inside VMs in the cloud sometimes nested in other VMs. This causes pauses in execution as the VM may be applying different techniques to manage multi-tenency—throttling, pausing execution, and so on. Benchmarking code can have different results compared to running locally on your machine for this reason.

  • LLM-First Programming Language

    There are many barriers to adoption for a new programming language looking to go mainstream. You have to attract a small group of enthusiasts, build an ecosystem of high quality libraries, help new people learn, and eventually grow a talent marketplace.

  • Containing Multitudes on the Internet

    The internet is a place of digital abundance with zero friction to publishing. Building an audience is increasingly important for one’s long-term prospects. This leads to deep niches filling the internet.

  • Coming Back to Rust After 4 Years

    I recently picked up rust for a personal infrastructure project and was amazed at the amount of progress on the language and tooling over the years.

  • Airplane Test of Programming Languages

    The airplane test measures the (often binary) ability to write code in a specified programming language while secluded on an airplane with no internet access. It shows the programming language’s capability to unblock the programmer and is an indicator of productivity.

  • A Non-Nullable Value Reduces Complexity by Half

    A small thing I realized about programming is that nullable values carry a sneaky amount of complexity in code. Whether or not your programming language forces you to deal with it (like rust), there exists two possible states for every nullable values. If that value interacts with more nullable values, complexity increases exponentially.

  • Interior Mutability

    In rust, a variable is declared as mutable or immutable and all of it’s fields (in the case of a struct) are declared the same–you can’t mutate a field while also making a borrow of another field.

  • Learning Fringe Programming Languages Makes You Faster

    Learning a programming language that is immature and substantially different from what’s commonly used in the industry makes you faster at programming, specifically debugging and unblocking. These skills generalize to any programming and make you faster at ‘figuring things out’ next time something unexpected happens.