Brandon's Website Personal website of Brandon Smith Rust's BufRead, And When To Use It Tue, 28 Feb 2023 00:00:00 GMT Rust is a low-level language, and its standard library is careful to give the programmer lots of control over how things will behave and avoid implicit behavior, especially when that behavior impacts performance. But at the same time, it doesn't want to make the programmer's life harder than it needs to be. As a result, Rust's language features and standard library often give you access to really low-level concepts with no assumptions baked in, but then also give you abstractions you can optionally layer on top. Another Update On The Bagel Language Sun, 03 Jul 2022 00:00:00 GMT Hi all. It's been about five months since my last Bagel post, so I wanted to give an update for the handful of you who have been interested/following along (thank you!). Bagel Bites: Type Refinement Sun, 13 Feb 2022 00:00:00 GMT I'm stuck solving a gnarly problem right now, so I thought I'd switch gears and write about a recent win in Bagel's design/implementation that I'm really excited about. Grasping React Hooks Wed, 02 Feb 2022 00:00:00 GMT Hooks are weird, and can be hard to reason about. They kind of (but don't actually!) establish a new domain-specific language on top of JavaScript, with its own set of rules and behaviors, and they can make it easy to lose track of what's actually really happening in your code. Bagel Bites 🥯 (Update on the Bagel Language) Sat, 22 Jan 2022 00:00:00 GMT It's been about four months since I last posted about Bagel, the new JavaScript-targeted programming language I've been working on. A lot has changed since then, but things are finally crystallizing and getting into a clear-enough space where I feel comfortable sharing some concrete details (and real code!). Three Kinds of Polymorphism in Rust Wed, 05 Jan 2022 00:00:00 GMT This information probably won't be new to you if you've been writing Rust for a bit! But I'm hoping the framing will be useful anyway. It's been useful for me. The Bagel Language 🥯 Thu, 16 Sep 2021 00:00:00 GMT I've started working on a programming language. Casual Parsing in JavaScript Mon, 16 Aug 2021 00:00:00 GMT Over the last year and a half I've gotten really into writing parsers and parser-adjacent things like interpreters, transpilers, etc. I've done most of these projects in JavaScript, and I've settled into a nice little pattern that I re-use across projects. I wanted to share it because I think it's neat, and it's brought me joy, and it could be an interesting or entertaining thing for others to follow along with! Why Rust strings seem hard Tue, 13 Apr 2021 00:00:00 GMT Lately I've been seeing lots of anecdotes from people trying to get into Rust who get really hung up on strings (&str, String, and their relationship). Beyond Rust's usual challenges around ownership, there can be an added layer of frustration because strings are so easy in the great majority of languages. You just add them together, split them, whatever! They're primitives that you can do whatever you want with. For someone who's only ever known this mental model (which is to say, never worked much with C/C++), using strings in Rust can be a rude awakening. They feel very complicated, have all these restrictions and extra steps, and it all just seems so unnecessary. Write code. Not too much. Mostly functions. Tue, 15 Dec 2020 00:00:00 GMT There's a well-known quote by author Michael Pollan: "Eat food. Not too much. Mostly plants." I like it because it doesn't attempt to be dogmatic: it encapsulates some basic guiding principles that get you 90% of the way there 90% of the time. Wikipedia describes the book the quote is from (emphasis mine): My Favorite Rust Function Signature Wed, 16 Sep 2020 00:00:00 GMT I've gotten really into writing parsers lately, and Rust has turned out to be the perfect language for that. In the course of my adventures, I came up with the following: Beware of Async/Await Wed, 29 Jul 2020 00:00:00 GMT Can you spot the problem with this piece of code? Does computing make the world better? Sun, 21 Jun 2020 00:00:00 GMT I was reading an article the other day about some recent headway being made in type theory. It was exciting stuff; stuff that may one day make systems faster, more reliable, more expressive. It felt very important in a vague way. But it also got me thinking: is this really going to make the world a better place than it was before? Write Libraries, Not Frameworks Fri, 08 May 2020 00:00:00 GMT Normally when I write about something on here I take the time to fully think-out a point, make a case, address all the major sides of the issue that I can think of, etc. Three Types of Data Wed, 05 Feb 2020 00:00:00 GMT In my work I've developed a mental framework related to data modeling, which has helped greatly both when coming up with a model and when making decisions down the road about how to use that model. Here I will establish three different categories of data in software: Constants, State, and Cached Values. By "data" I generally mean "variables in code", but the same principles could be applied to files on a disk, or tables in a database, or whatever else. Procedures, Functions, Data Sat, 23 Nov 2019 00:00:00 GMT Functional programming is all the rage these days. There are piles of Medium posts out there singing its praises, preaching the good word. And for good reason! It can be a powerful paradigm for reducing code duplication and preventing sprawling side-effects. Evolution and Software Development Wed, 09 Oct 2019 00:00:00 GMT I was at one point introduced to the recurrent laryngeal nerve. Put simply, this is a nerve that exists in several types of animals, including humans, which instead of taking a very obvious direct path from source to destination, wraps hilariously around a major artery before doubling back and getting on its way: New Website Tue, 01 Oct 2019 00:00:00 GMT I decided to rebuild my website from scratch.