Sorting Polymorphically in Many Languages

Polymorphism is a powerful programming language feature. In polymorphism, we have generic functions that don’t know exactly what type of data they will be operating on. Often, the data types won’t even all have been designed yet when the generic function is written. The generic function provides the general outline of the work, but the details of some parts of the work, some specific operations, must be tailored to the specific types being used.

A Review of Self-Help as a Genre, and Atomic Habits in Particular

I enjoyed reading Atomic Habits, which was recommended to me by my therapist. I found this blog post basically finished in my attic folder while sorting through things, and I found it up to posting, even though my records show I read Atomic Habits way back in … October 2022. Self-Help in General Atomic Habits is pretty fundamentally a “self help book.” This is a pretty controversial genre in my experience.

Minor News: Some Repos on GitHub

So, there are now two additional repos of my code on GitHub that recently got published, both under the MIT license. Neither is any show-stopping major project, but I figured I’d let everyone know nevertheless, and write up a few notes about it. Both have been added to my programming portfolio garden. Repo #1: Crate Version of Prefix Ranges Arvid Norlander (blog, GitHub) reached out to me to ask if I wanted to publish my little Rust module from my post on prefix ranges as a crate, or, failing that, if I could license it as open source so he could publish it.

Review: One Billion Americans, by Matthew Yglesias

This was a great read about how the United States should reframe many of its basic political assumptions. It is tempting to think of life as a zero-sum game. Having more for me, even enough for me, means less or even not enough for others. Usually, we have the open-mindedness to feel like we can cooperate with some few – our family, our community, or perhaps our nation or religion or even (problematically) our ethnic group.

Is Section 3 of the 14th Amendment Undemocratic?

US politics continue to be interesting. As many of you know, the Colorado Supreme Court has recently ruled that Donald Trump should be struck from the ballot in Colorado. Under Section 3 of the 14th Amendment to the US Constitution, if you’ve sworn to support the Constitution, and then engaged in (or “given aid or comfort to”) an insurrection, you are no longer eligible to serve in office. The Colorado Supreme Court applied this law to Trump, citing the Capitol attack of January 6, 2021.

2023 in Retrospective and 2024 in Prospective

Another year has gone by And in response, I simply sigh Another year has taken place I guess I’ll handle it with grace? Another year, the same old grind… And yet I feel I’ve fallen behind As you might know if you’ve read my equivalent post from last year, I am now 35 years old (and 3 days). If we consider “working years” to range from 20 to 65 – which seems a decent definition – then I am 1/3 of the way through them, 1/3 of the way through my career.

Rust Is Beyond Object-Oriented, Part 3: Inheritance

In this next1 post of my series explaining how Rust is better off without Object-Oriented Programming, I discuss the last and (in my opinion) the weirdest of OOP’s 3 traditional pillars. It’s not encapsulation, a great idea which exists in some form in every modern programming language, just OOP does it oddly. It’s not polymorphism, also a great idea that OOP puts too many restrictions on, and that Rust borrows a better design for from Haskell (with syntax from C++).

Are You Sure? (Revised)

This is a revision of a flash fiction piece first published in 2018. After a year of talking, and another year of planning, the project was complete. Mothers Against Drunk Driving, the local clergy, and the town council had finally done it: Right in the town square, they installed a giant loudspeaker. From thenceforth, every two minutes, a booming voice would spread all over town, announcing: ARE YOU SURE? Foolhardy decisions, they had decreed, would soon be a thing of the past.

Endianness, and why I don’t like htons(3) and friends

Endianness is a long-standing headache for many a computer science student, and a thorn in the side of practitioners. I have already written some about it in a different context. Today, I’d like to talk more about how to deal with endianness in programming languages and APIs, especially how to deal with it in a principled, type-safe way. Before we get to that, I want to make some preliminary clarifications about endianness, which will help inform our API design.

Operating Systems: What is the command line?

This is my newest post in my series about operating systems. Yes, it was last updated in 2019 – I’m a hobbyist blogger. This is a post about the command line, a computer topic, but it is for educating a non-technical (but tech-curious) audience. Most of the programmers in my audience will already know everything I have to say, and may be bored by some explanation of things they already know, though I intend to discuss some technical details of how computers work.

Can computers think things?

This blog post isn’t about ChatGPT. It isn’t about machine learning, neural nets, or any mysterious or border-line spiritual form of computing. That’s a whole ’nother set of philosophical and metaphysical conundrums (conundra?). This is about a way people sometimes speak, informally, about bog-standard boring non-AI computers and computer programs. You’ve probably heard people speak this way. You’ve probably spoken this way sometimes yourself: “The server thinks your password is wrong.

Verbal Tics

I remember hearing an idea once – I’d like to cite it, but proper citation seems difficult, as I heard it from an acquaintance, and Mr. Google isn’t being his usual helpful self. The idea was, different politicians have these verbal tics, these filler catch-phrases, that indicate their deepest conversational anxieties. For President Obama, it’s “let me be clear.” According to this thesis, he is really concerned about being unclear, and this tic is so prominent in his speech that it shows that his biggest anxiety is being insufficiently clear about something, as waffling, or evading the deep issue underlying all the petty concerns.

My Dream C++ Additions

UPDATE: I have updated this post to address C++ features that address these issues or have been purported to. I have long day-dreamed about useful improvements to C++. Some of these are inspired by Rust, but some of these are ideas I already had before I learned Rust. Each of these would make programming C++ a better experience, usually in a minor way. Explicit self reference instead of implicit this pointer UPDATE: This is coming out in C++23, and they did it right!

In Defense of ‘C/C++’

One of the minor points I discussed in my response to Dr. Bjarne Stroustrup’s memory safety comments was the controversial, apparently deeply upsetting term C/C++. It is controversial and interesting enough that I decided to say a little more about it here. A little background: Many people, especially outside the C and C++ communities (which, to be clear, don’t always like each other that much) use the term C/C++ to talk about the two programming languages together, as an informal short-hand for “C and C++” or “C or C++.

C++ Papercuts

UPDATE: Wow, this post has gotten popular! I’ve written a new post that adds new papercuts combined with concrete suggestions for how C++ could improve, if you are interested. Also, if you want to read more about C++’s deeper-than-papercut issues, I recommend specifically my post on its move semantics. Thank you for reading! My current day job is now again a C++ role. And so, I find myself again focusing in this blog post on the downsides of C++.

New Link: Technical Only RSS

TLDR: I am adding a new link for RSS subscribers who just want to subscribe to technical posts. The RSS feed has always been available, but it is now explicitly one of the links across the top, for those who want their RSS feed to only give them my new technical posts. I am writing this post primarily to let people know about this new link, but I also want to muse on it a little.

The Curse of Coffee

TRIBUNAL PROCEEDING TRANSCRIPT SUB LEGIBUS ORDINIS SACROSANCTI IMMORTALIUM PROVISIONAL PROOF TEXT IN THE CASE OF: ŌRDŌ SACROSANCTUS VERSUS THE NAMELESS DAUGHTER OF MUŠMAḪḪU THE SEVEN-HEADED SERPENT, SHE WHO IS KNOWN TO THE MORTALS AS EUNICE LORD JUSTICE MEPHISTO, PRESIDING LORD JUSTICE DRACHENMILCH, LORD JUSTICE BA’AL-HA-KHUMUS, AND LORD LADY JUSTICE XYXXYZ MR. AZAXAZALIA, ESQ., PROSECUTOR MS. “EUNICE”, DEFENDANT A RECORD OF EUNICE‘S TESTIMONY TRANSCRIBED BY GEORGE SMITH, HUMAN, JUNIOR APPRENTICE CLERK

On ADHD Medication

Here’s a story; stop me if you’ve heard it before. There’s a child, an energetic, enthusiastic child, perhaps hard to deal with in some ways, but all around just beautiful. And then they go to a parochial school – or perhaps they just have a rather strict public school teacher. In either case, the authority figure makes it their wicked mission to suppress all the beautiful children’s personalities into identical, well-behaved zombies in the interest of the idol of order.

Walk-Through: Prefix Ranges in Rust, a Surprisingly Deep Dive

Update: Arvid Norlander has gone through the trouble of refactoring this code into a crate and publishing it. Thank you, Arvid! Rust’s BTreeMap and corresponding BTreeSet are excellent, B-tree-based sorted map and key types. The map implements the ergonomic entry API, more flexible than other map APIs, made possible by the borrow checker. They are implemented with the more performant but more gnarly B-Tree data structure, rather than the more common AVL trees or red-black trees.

Fiction Review: The Long Way to a Small Angry Planet

I already enjoyed the Monk and Robot series by Becky Chambers (A Psalm for the Wild-Built and A Prayer for the Crown-Shy). It’s now one of my favorite books. so I was excited to also read her earlier work, the Wayfarer series, starting with The Long Way to a Small, Angry Planet, and it did not disappoint me. Both these series are science fiction. While Monk and Robot is solarpunk, a relatively new sub-genre focused on imagining a world with major environmental (and economic) problems solved, the Wayfarer series much more reminds me of the kind of science fiction I used to read as a kid.

Debt Ceiling, Redux

So you might or might not be aware about the debt ceiling argument currently taking place in the US. I’ve already written about this, but President Biden for some reason didn’t listen to me (perhaps because he doesn’t read my blog – which is disappointing). Other, more famous people have written about it too,, but the President insists on pretending he has to make a deal with the Republicans. So, to catch everyone up, here’s how this all works.

There is No One True Best Programming Language (but some are still better than others)

I am no stranger to programming language controversy. I have a whole category on my blog dedicated to explaining why Rust is better than C++, and I’ve taken the extra step of organizing it into an MDBook for everyone’s convenience. Most of them have been argued about on Reddit, and a few even on Hacker News. Every single one of them have been subject to critique, and in the process, I’ve been exposed to every corner, every trope and tone and approach of programming language debate religious war, from the polite and well-considered to the tiresome and repetitive all the way to the rude and non-sensical.

x86S: A Long Time Coming

Intel has just released a new white paper, where they discuss removing a lot of the legacy cruft of the Intel/AMD architecture they call Intel64. Only 64-bit operating systems – and a narrow set of 32-bit legacy apps that don’t use segmentation (a small subset in theory but basically all of them in practice) – will be supported. I am surprised at how excited I am, although after all this time perhaps the better word is “relieved.

Voice is Hard

I was reading my ADHD blog post today, considering whether to send it to a friend, and it was surprisingly hard for me to bring myself to. I realized I was embarrassed at the voice, the phrasing, the lack of beauty in the individual words, all of which is something I paid relatively little attention to before – and which my friend, who also writes, will definitely notice. It’s something I’ve paid less attention to than I should.

A New Garden: Rust vs C++ mdbook

Here it is, the Rust vs C++ mdbook. I’ve wanted for a while to re-organize some of the content on my blog into gardens. I got the idea from the blog post “The Garden and the Stream: A Technopastoral”. Basically, some content is ill-suited to date-based, time-organized systems like blogs. In fact, most of my content remains valid over a long period of time, rather than participating in conversation (with some exceptions), but rapidly becomes less discoverable after I’ve written it, as it is buried by newer posts.

This Little Piggy Did Crime

Rust: A New Attempt at C++’s Main Goal

I know I set the goal for myself of doing less polemics and more education, but here I return for another Rust vs C++ post. I did say I doubted I would be able to get fully away from polemics, however, and I genuinely think this post will help contextualize the general Rust vs. C++ debate and contribute to the conversation. Besides, most of the outlining and thinking for this post – which is the majority of the work of writing – was already done when I set that goal.

Strattera in 100 Words

It is half past noon. I have done no work, not even from bed, where I somehow still am. My laptop is on, to-do list open. I’ve checked messages, even replied to one or two, but when I go to do something, I find myself several minutes later not having done it. I’d used the bathroom instead. Or something else? What was it? What was I going to do first, again?

Guest Collaboration: Paradigm Shift

Does the choice of programming language matter? For years, many programmers would answer “no”. There was an “OOP consensus” across languages as different as C++ and Python. Choice of programming language was just a matter of which syntax to use to express the same OOP patterns, or what libraries were needed for the application. Language features like type checking or closures were seen as incidental, mere curiosities or distractions. To the extent there was a spectrum of opinions, it was between OOP denizens and those that didn’t really think software architecture mattered at all — an feeble attempt of corporatization against true programmers and their free-spirited ways.

Rust Tidbits #1

This is a collection of little Rust thoughts that weren’t complicated enough for a full post. I saved them up until I had a few, and now I’m posting the collection. I plan on continuing to do this again for such little thoughts, thus the #1 in the title. serde flattening What if you want to read a JSON file, process some of the fields, and write it back out, without changing the other fields?

Treat Tolkien’s World Like Other Mythologies

Tolkien was trying to make a new mythology, a new set of deeply resonant stories, for modern (especially English) culture, and he succeeded. He transformed fantasy, and founded the concept of high fantasy. His detailed legendarium (as his mythology is called) is a masterpiece of world-building, with deep symbolism and emotional complexity, a mythology with arguably more depth and room to explore than many ancient ones. Tolkien scholars work full-time to study it, and many more people draw from it explicitly and implicitly for their own art, in D&D and other more modern fantasy settings.

The Importance of Logging

Intro programming classes will nag you to do all sorts of programming chores: make sure your code actually compiles, write unit tests, write comments, split the code into functions (though sometimes the commenting and factoring advice is bad). Today, however, I want to talk about one little chore, one particular little habit, that is just as essential as all of those things, but rarely covered in the CS100 lectures or grading rubrics: logging.

Write Everything Down (Part 4): My Desktop Environment

I’d like to share with you how I use my computer, in a way that is (for me) ADHD friendly and well-suited for implementing my organization system. Tools are important to any organizational and productivity system, and optimizing your tools for your brain and your workflow are important. My computer is my most important productivity tool, where my work happens, and where my life/chore/errand/calendar organization happens, so it should be an interesting example of an optimized key tool.

Rust Is Beyond Object-Oriented, Part 2: Polymorphism

In this post, I continue my series on how Rust differs from the traditional object-oriented programming paradigm by discussing the second of the three traditional pillars of OOP: polymorphism. Polymorphism is an especially big topic in object-oriented programming, perhaps the most important of its three pillars. Several books could be (and have been) written on what polymorphism is, how various programming languages have implemented it (both within the OOP world and outside of it – yes, polymorphism exists outside of OOP), how to use it effectively, and when not to use it.

The Debt Ceiling Is Unconstitutional, and Biden Should Just Say So

The validity of the public debt of the United States, authorized by law, including debts incurred for payment of pensions and bounties for services in suppressing insurrection or rebellion, shall not be questioned. US Constitution, 14th Amendment, Section 4 The debt ceiling is unconstitutional. We’ve let the Republicans play their games for long enough, in the interest of “stability of the economy” and a general fear of rocking the boat, but that time is over now.

My Reaction to Dr. Stroustrup’s Recent Memory Safety Comments

The NSA recently published a Cybersecurity Information Sheet about the importance of memory safety, where they recommended moving from memory-unsafe programming languages (like C and C++) to memory-safe ones (like Rust). Dr. Bjarne Stroustrup, the original creator of C++, has made some waves with his response. To be honest, I was disappointed. As a current die-hard Rustacean and former die-hard C++ programmer, I have thought (and blogged) quite a bit about the topic of Rust vs C++.

Complexities of Defining ADHD

ADHD is a controversial topic, and it’s never been more relevant. Diagnoses are soaring right now, driven up by a variety of interacting forces. Open discussion about ADHD – and the related general concept of “neurodiversity” – has been exploding on the Internet. And recently, there’s been a very unfortunate Adderall shortage. So I wanted to take an opportunity to share some thoughts about it. I would say that I was taking this opportunity to clear things up, but unfortunately, that might not be possible.

Rust and Default Parameters

Rust doesn’t support default parameters in function signatures. And unlike in many languages, there’s no way to simulate them with function overloading. This is frustrating for many new Rustaceans coming from other programming languages, so I want to explain why this is actually a good thing, and how to use the Default trait and struct update syntax to achieve similar results. Default parameters (and function overloading) are not part of object-oriented programming, but they are a common feature of a lot of the programming languages new Rustaceans are coming from.

Christmas Disappointment: Smashing Princes and Cities

Today, in liturgical Western Christianity, it is the 10th day of Christmas. Merry Christmas to those who celebrate the extended edition of the holiday! Unfortunately, this essay is not a celebration of Christmas, but rather an explanation of why I have often found it disappointing recently in life, because of a disconnect between the promise and the reality. Every time Christmas comes around, I think of a classical sacred choral piece that I’ve performed in multiple different choirs in youth and adulthood, from Mendelssohn’s Christus, namely “Es Wird ein Stern aus Jakob Aufgeh’n” (“There shall come a star out of Jacob”).

A Life (and Blog) Theme for the Coming Year

Happy December! Happy Winter Holidays! We’re almost done with 2022! I just had my birthday yesterday, on December 20. I am now 34 years old, which is more than a third of a century! I generally take the opportunity on my birthday to do some reflection on the previous year, and to set a theme for the next year. I wanted to share both with you, my audience. The past year has been intense for me personally.

Rust Is Beyond Object-Oriented, Part 1: Intro and Encapsulation

Rust is not an object oriented programming language. Rust may look like an object-oriented programming language: Types can be associated with “methods,” either “intrinsic” or through “traits.” Methods can often be invoked with C++ or Java-style OOP syntax: map.insert(key, value) or foo.clone(). Just like in an OOP language, this syntax involves a “receiver” argument placed before a . in the caller, called self in the callee. But make no mistake: Though it may borrow some of the trappings, some of the terminology and syntax, Rust is not an object-oriented programming language.

How to Write a JIRA Ticket in … Relatively Few Steps

If you’re confused by how to use JIRA effectively, do not worry! If you learn this process, which is very simple not literally impossible, you too can become good at JIRA passingly competent at JIRA not liable to being fired for being bad at JIRA. Here are the steps: Create personal TODO item to write JIRA ticket Accumulate requirements for JIRA ticket in personal notes Often more complicated than the feature itself This is the System Working™ Write TODO items strategizing how to: Share the JIRA ticket with other people Connect it properly with other JIRA tickets Advanced: Also epics, projects, or other meta-JIRA constructs Write JIRA ticket Fail to understand what any of the fields are for Oh, they’re required?

First Impressions of Asahi Linux

I bought my M1 Mac over a year ago with the intention of installing Asahi Linux on it, but I never got around to it until now. I am still thrilled to be using an ARM workstation made by a major computer manufacturer, and it’s good to be able to run the operating system of my choice on it (though macOS is acceptable for entertainment and video calls, Linux is what I work and do my organization in).

RAII: Compile-Time Memory Management in C++ and Rust

I don’t want you to think of me as a hater of C++. In spite of the fact that I’ve been writing a Rust vs C++ blog series in Rust’s favor (in which this post is the latest installment), I am very aware that Rust as it exists would never have been possible without C++. Like all new technology and science, Rust stands on the shoulders of giants, and many of those giants contributed to C++.

Write Everything Down (Part 3): My Personal Organizational System

As promised in my previous posts about organization, I will now go into some detail about my own organizational system. But before I start talking about it, and how I came to develop it, I’d like to emphasize a few points, or more specifically, three caveats, lest Zeus strike me down with a thunderbolt for my hubris: Caveat the First: My system is a work in progress. Even though it is overall very helpful, it’s always falling apart a little bit.

Write Everything Down (Part 2): Failed Organizational Systems

In my previous post on organization, I concluded with this statement: As everyone’s brain works differently (whether ADHD or not), people differ tremendously in what their ideal organizational systems are. For me, I am much less productive if I have a less than ideal system – the stakes are very high. But even for people who can be productive on any system, I think that tailoring their system to their brain, their lifestyle, their job and schedule and hobbies, can have amazing results.

A Strong Typing Example

I’m a Rust programmer and in general a fan of strong typing over dynamic or duck typing. But a lot of advocacy for strong typing doesn’t actually give examples of the bugs it can prevent, or it gives overly simplistic examples that don’t really ring true to actual experience. Today, I have a longer-form example of where static typing can help prevent bugs before they happen. The Problem Imagine you have a process that receives messages and must respond to them.

Exploring Traits with Erased ‘serde’

I came across a programming problem recently where I wanted to use dynamic polymorphism with serde. This turned out to be much easier than I expected, and I thought it was an interesting enough case study to share, especially for people who are learning Rust. A Brief Discussion of Polymorphism in Rust As most of you will know, Rust’s system for polymorphism – traits – supports both static and dynamic polymorphism, with a bias towards static polymorphism.

Write Everything Down (Part 1)

Memory Leak I have an excellent memory. I have a terrible memory. Well, which one is it? This is a confusing state to be in. It can be frustrating to people around me. How is it – my father used to ask me when I was in high school – that I could remember all the lessons and readings for my tests in school, and get all the good grades, but couldn’t ever remember to do the simplest task or household chore, or to bring with me the simplest item?

Blocking Sockets and Async

Using async in Rust can lead to bad surprises. I recently came across a particularly gnarly one, and I thought it was interesting enough to share a little discussion. I think that we are too used to the burden of separating async from blocking being on the programmer, and Rust can and should do better, and so can operating system APIs, especially in subtle situations like the one I describe here.

Why Rust should only have provided expect for turning errors into panics, and not also provided unwrap

UPDATE 2: I have made the title longer because people seem to be insisting on misunderstanding me, giving examples where the only reasonable thing to do is to escalate an Err into a panic. Indeed, such situations exist. I am not advocating for panic-free code. I am advocating that expect should be used for those functions, and if a function is particularly prone to being called like that (e.g. Mutex::lock or regex compilation), there should be a panicking version.

Fiction Review: Plain Truth

I enjoyed Plain Truth by Jodi Picoult. I finished it a couple of months ago, when I was feeling very restless and impatient about everything going on in my life. At the time, I desperately needed fun books to read, but I was simultaneously having a lot of trouble finishing books. This book pulled me the whole way through when other books were failing to: It was in a setting, the Amish communities, that had always interested me.

Another Confusing Haskell Error Message

The Error Message I’ve written before about just how befuddling Haskell error messages can be, especially for beginners. And now, even though I have some professional Haskell development under my belt, I ran across a Haskell error message that confused me for a bit, where I had to get help. It’s clear to me now when I look at the error message what it’s trying to say, but I legitimately was stumped by it, and so, even though it’s embarrassing for me now, I feel the need to write about how this error message could have been easier to understand:

Command Line Interface UXes Need Love, Too

It took me a long time to admit to myself that the venerable Unix command line interface is stuck in the past and in need of a refresh, but it was a formative moment in my development as a programmer when I finally did. Coming from that perspective, I am very glad that there is a new wave of enthusiasm (coming especially from the Rust community) to build new tools that are fixing some of the problems with this very old and established user-interface.

Why I Won’t Correct You’re Grammar (unless you ask)

I am an Ivy League-educated professional who regularly has to write for my job, who was always in the top English classes in school. And sometimes, I mix up “your” and “you’re.” I know how grammar works. I always, if I stop to think about it, can figure out which one to use. I know all the tricks. Most of the time, I don’t have to think about it, and the right one comes out.

Trivia About Rust Types: An (Authorized) Transcription of Jon Gjengset’s Twitter Thread

Preface (by Jimmy Hartzell) I am a huge fan of Jon Gjengset’s Rust for Rustaceans, an excellent book to bridge the gap between beginner Rust programming skills and becoming a fully-functional member of the Rust community. He’s famous for his YouTube channel as well; I’ve heard good things about it (watching video instruction isn’t really my thing personally). I have also greatly enjoyed his Twitter feed, and especially have enjoyed the thread surrounding this tweet:

Function Overloading in Rust

I just made a pull request to reqwest. I thought this particular one was interesting enough to be worth blogging about, so I am. We know that many C++ family languages have a feature known as function overloading, where two functions or methods can exist with the same name but different argument types. It looks something like this: void use_connector(ConnectorA conn) { // IMPL } void use_connector(ConnectorB conn) { // IMPL } The compiler then chooses which method to call, at compile-time, based on the static type of the argument.

Reviews and Reactions: 2022 Short Story Hugo Nominees

We decided to write up our thoughts on each of the short stories nominated for the 2022 Hugo awards. Of course, here be spoilers, spoilers galore. If you don’t want these stories spoiled, go read them, and then come back here. This is the same concept as Jimmy’s review of the 2021 nominees, and so we shall adapt the explanation from that post: As an exercise, we read each of these stories and told each other what we thought the themes were, and I reference that throughout these reflections.

Netflix Should Become a Tech Company

Netflix should become a tech company. I hear the obvious response already: Jimmy, Netflix is already a tech company! Counterpoint: Is it though? Somehow, after two dot-com booms, the markets still have an aesthetic-based definition of what constitutes a “tech company”: If a company – any company – has an expensive enough app, and if its founders talk enough about “disrupting” industries, then it is a “tech company” and is therefore entitled to a valuation completely disconnected from its actual industry.

Can you have too many programming language features?

There’s more than one way to do it. Perl motto There should be one– and preferably only one –obvious way to do it. The Zen of Python (inconsistent formatting is part of the quote) When it comes to statically-typed systems programming languages, C++ is the Perl, and Rust is the Python. In this post, the next installment of my Rust vs C++ series, I will attempt to explain why C++’s feature-set is problematic, and explain how Rust does better.

A Checklist of Dev-Ops Disciplines

I have worked on a lot of programming projects in my time, and while I was a programming consultant I have worked in a lot of different corporate environments. At some of them, it was easy to be concretely productive: I was able to contribute immediately, and at a rapid rate. At others, actual useful contributions would be impossible until I had a month or more of experience with a codebase, and even then every change would be a long slog.

God grant me patience… and I want it RIGHT NOW!

I’ve been feeling recently like I’ve been spinning my wheels in my personal life. I’m pressing on the metaphorical accelerator as hard as I can, probably too hard for safety, and instead of moving forward, the wheels are just spinning, spinning, spinning. I think a large part of it is my perspective of time. “Time is canceled,” my friends and I would say continuously during the lockdown. And it isn’t back, not yet, not how it used to be, not for me.

More on Mortgages

Mortgage interest rates have recently risen, and are currently very volatile. At the time of this writing, PSECU, my credit union, is offering mortgages at 5.125%, much higher than the 3.125% I locked in at, but lower than the peak above 6% I had recently read about in the news. But what does this mean in practice? Well, let’s run some numbers. Understanding how expensive a house is can be confusing.

Reviews and Reactions: 2021 Short Story Hugo Nominees

NB: These are for the 2021 Hugo awards, not the recently-announced 2022 Hugo awards. That one is coming soon. I decided to write up my thoughts on each of the short stories nominated for the 2021 Hugo awards. Of course, here be spoilers, spoilers galore. If you don’t want these stories spoiled, go read them, and then come back here. As an exercise, a friend and I read each of these stories and told each other what we thought the themes were, and I reference that throughout these reflections.

Review: The Comic Book Story of Beer

I like beer, and I like comic books, so I was excited to read The Comic Book Story of Beer. And it was overall quite a fun read! It contextualized how important beer was in antiquity – including theories that beer catalyzed the agricultural revolution – and how important it’s been in society ever since, taking a social approach to the entire history, while also explaining a lot of the science alongside the primarily social narrative.

Can you reproduce it?

NOTE: This post has the #programming tag, but is intended to be comprehensible by everyone, programmer or not. In fact, I hope some non-programmers read it, as my goal with this post is to explain some of what it means to be a programmer to non-programmers. Therefore, it is also tagged with “nontechnical”. What is the most important skill for a software engineer? It’s definitely not any particular programming language; they come and go, and a good programmer can pick them up as they work.

A Rust Gem: The Rust Map API

For my next entry in my series comparing Rust to C++, I will be discussing a specific data structure API: the Rust map API. Maps are often one of the more awkward parts of a collections library, and the Rust map API is top-notch, especially its entry API – I literally squealed when I first learned about entries. And as we shall discuss, this isn’t just because Rust made better choices than other standard libraries when designing the maps API.

Biking to Philly

I am out of biking shape. I know I am out of biking shape. The pandemic has not been good to my physical fitness. (For the record, this isn’t a proper edited and outlined and triaged essay, just some notes on my past weekend.) But as out of shape as I am, I also know it’s only 25 miles from here to Philly on the Schuylkill River Trail, and so I figured maybe I could do it without any additional prep.

Crank-’em Out

For a time, I tried to cultivate an interest in Go. Not this Go, but this Go. The interest didn’t last long – like chess, I had a hard time getting up to even a fairly basic level of competence. And I quickly developed another enthusiastic interest to replace it – sometimes, an interest just doesn’t work out, and it’s nobody’s fault, and you have to just move on and not get too sad, because there’s plenty of fish in the sea.

The Good Ol’ Days of QBasic Nibbles

Let’s talk about an ancient programming language! I think we can all learn things from history, and it gives us grounding to realize that our time is just one time among many, to see what people in the past did differently, what they got wrong that we would never do now, and also to see what they got right. Do you remember MS-DOS? Do you remember that it came with an interpreted programming language?

Warnings and Linter Errors: The Awkward Middle Children

What is “bad” Rust? When we say that a snippet of code is “bad” Rust, it’s ambiguous. We might on the one hand mean that it is “invalid” Rust, like the following function (standing on its own in a module): fn foo(bar: u32) -> u32 { bar + baz // but baz is never declared... } In this situation, a rule of the programming language has been violated. The compiler stops compiling and does not output a binary.

Haskell Error Messages: Come on!

I am a big fan of strongly typed languages, and my favorite GC’d language is Haskell. And I want you, the reader, to keep that in mind today. What I am writing is some commentary about a language I deeply love, some loving criticism. So here’s what happened: A few days ago, I was showing off some Haskell for a friend who primarily programs in Python. The stakes were high – could I demonstrate that this strange language was worth some investigation?

Mortgages are Interesting

I just bought a house, and it came with a mortgage. I bought the house and committed to the mortgage all in one ceremony, in a cute little office where I signed enough papers that the sellers were able to solemnly hand me the keys to my new castle. In the lead-up to this, I was told how early payments, mortgage insurance, and refinancing works, and it’s – I think very reasonably – been on my mind since.

Burying the Lede

Imagine you don’t know who Napoleon was. You know he’s a figure from history, but you don’t even know he has to do with France. And imagine, when you read the Wikipedia article, for some reason you skip the opening paragraphs above the fold, and you’re reading about his upbringing in Corsica as a petty Italian noble under French rule. And you just want to know, why’s this guy important, what’s his deal, why do people keep talking about him (something military, it seems?

Being Fair about Memory Safety and Performance

For this next iteration in my series comparing Rust to C++, I want to talk about something I’ve been avoiding so far: memory safety. I’ve been avoiding this topic so far because I think it is the most discussed difference between C++ and Rust, and therefore I felt I’d have relatively little to add to the conversation. I’ve also been avoiding it because I wanted to draw attention to all the other little ways in which Rust is a better-designed programming language, to say that even if you concede to the C++ people that Rust isn’t “truly memory safe” or “memory safe enough,” Rust still wins.

In Defense of Async: Function Colors Are Rusty

Finally in 2019, Rust stabilized the async feature, which supports asynchronous operations in a way that doesn’t require multiple operating system threads. This feature was so anticipated and hyped and in demand that there was a website whose sole purpose was to announce its stabilization. async was controversial from its inception; it’s still controversial today; and in this post I am throwing my own 2 cents into this controversy, in defense of the feature.

Endianness, API Design, and Polymorphism in Rust

I have been working on a serialization project recently that involves endianness (also known as byte order), and it caused me to explore parts of the Rust standard library that deals with endianness, and share my thoughts about how endianness should be represented in a programming language and its standard library, as I think this is also something that Rust does better than C++, and also makes for a good case study to talk about API design and polymorphism in Rust.

C++ Move Semantics Considered Harmful (Rust is better)

This post is part of my series comparing C++ to Rust, which I introduced with a discussion of C++ and Rust syntax. In this post, I discuss move semantics. This post is framed around the way moves are implemented in C++, and the fundamental problem with that implementation, With that context, I shall then explain how Rust implements the same feature. I know that move semantics in Rust are often confusing to new Rustaceans – though not as confusing as move semantics in C++ – and I think an exploration of how move semantics work in C++ can be helpful in understanding why Rust is designed the way it is, and why Rust is a better alternative to C++.

Sayonara, C++, and hello to Rust!

This past May, I started a new job working in Rust. I was somewhat skeptical of Rust for a while, but it turns out, it really is all it’s cracked up to be. As a long-time C++ programmer, and C++ instructor, I am convinced that Rust is better than C++ in all of C++’s application space, that for any new programming project where C++ would make sense as the programming language, Rust would make more sense.

A Modern Version

Humpty Dumpty sat on a wall
Humpty Dumpty had a great fall
All the king’s horses and all the king’s men
Were too busy deciding who would be king…
To even TRY to put Humpty Dumpty together again.
And he’s just sitting there, all yolk and shell, waiting…

Apple Silicon

This year, Apple released, to much fanfare, a somewhat obscure technical change to how its computers work: Macs will transition away from Intel’s CPUs to in-house processors known as “Apple Silicon,” more similar to the technology Apple already uses in its phones and tablets. It is a tremendous amount of hype for something rather technical, and to people used to more user-visible feature announcements, this can be somewhat disappointing, or at least confusing.

A Prudent Quarantine

Five Members sat in council. There are some activities, some patterns of human group behavior, that transcend era and culture, and meeting in council is one of them. In spite of the youth of the participants – they were in their late teens and early 20’s – and the informality of the setting – leather couches covered in scratch marks, unfinished walls – they still clearly were sitting in council. The seriousness with which they were watching the video, their intentional and controlled posturing and nuanced glances, would have been instantly recognizable to any Parliament or Diet throughout history.

A Respectable Octopedian

In front of Penny in line was a 7 foot tall humanoid with glowing blue skin. She suppressed the urge to ask what species they were, and let the alien order their vegan breakfast burrito. The barista at United Planets’ first-floor Starbucks looked human except for the extra hands. Polycherian, Penny remembered. When the barista handed Penny her order – an egg and cheese sandwich on a bagel – Penny bowed respectfully and said pflintsu – Polycherian for “thank you” – before getting on the elevator.

All Rent Should Be Cancelled

Even early last week, before restaurants were closed, before we were banned from unnecessary gatherings, when many people still had to go into their office jobs, the bars were empty on my street. I walked into one, ordered a cocktail, asked the bartender why it was so slow. It was usually slow on Tuesdays, of course, but normally there was at least one other customer. But the pandemic had already scared everyone else away, and if it continued, the bar would surely have to close.

Open Internet, Closed Web

The Internet promised — and still promises — a revolution in democratic, decentralized, and open communications. And yet, we see today a tech world controlled by a few central players, as Elizabeth Warren promises to break them up and Congress summons Mark Zuckerberg to explain his company’s role in privacy-violating election-manipulating foreign conspiracies. But Presidential use of anti-trust laws and new Congressional regulations of social media won’t address the more fundamental issues: The Internet is now structured, on a technical and social level, so as to naturally encourage centralized monopolies.

Just Jump

Kayleigh needed a break from work. When you need a break from work, sometimes you go to the bathroom. Sometimes you stop by the coffee machine, chat with a colleague while it brews. And sometimes, you straight-up leave the office and walk to a nearby bar. Today, Kayleigh found herself taking that last option. She didn’t normally do this — she felt that, as the boss, she had to hold herself to a higher standard than anyone else, and drinking before the end of the workday was against policy.

The Haskeller’s Hungarian Notation

When I was first learning to program, a long time ago, it was in BASIC, and you had to annotate your variable names to indicate what type something is. foo would be a number, whereas foo$ would be a string. This meant that there could only be as many types of information as there were symbols to put after your variable, but that was okay for the sort of programming BASIC was used for.

The Letter from the Trees

ENVELOPE HEADER: Date: January 5, 2027 To: Rachel Friedman, President of the United States and Leader of the Free World From: The Roots of the Great Trees of Galaxy-Wide Civilization Subject: An Offer, an Apology, and an Explanation The Offer In the name of the One Almighty God: in the name of the Many Stars through which God is made manifest, in the name of the manifestation of God you call the Sun, and in the name of Original Star from Before Time, we offer you peace, not of a lack of conflict, but of a mutual growth.

Components of a Modern Operating System

In previous posts, we discussed historic operating systems and where various OS features come from, but we only gave a brief overview of how they worked. Now that we have a modern operating system’s full complement of features, we can look at what components need to exist in a modern operating system to get those features. As discussed with MS-DOS, an operating system, even today, is partially code, and partially conventions, like file formats or rules of good behavior – the difference being, that modern operating systems have more ability to enforce some of these conventions.

Extra Version

There’s a lot of books and articles out there about how to interact with, or be, an introvert. Society really looks down on introverts, we hear, and even when it doesn’t, it certainly isn’t designed to be navigated by introverts. They’re a very misunderstood bunch, but they have a lot to contribute. Here’s how you can properly cherish them, etc. etc. Katelin couldn’t relate to any of this at all. Society not designed for introverts — bullshit!

Father, Forgive Them

Father, forgive them, for they do not know what they are doing. Jesus, on the cross (Luke 23:34) My grandfather always used to love telling a certain anecdote about Calvin Coolidge. He was a man of such few words that one time, President Coolidge went to hear a world-famous preacher preach. Upon returning from the sermon, his wife asked what it was about. He replied “sin.” Not satisfied with the answer, the wife asked, “Well, what did the preacher have to say about sin?

Experiences in Switzerland

Just wanted to write up a summary of random notes from my Switzerland trip, not including the conference which was also a lot of fun but I think less interesting for my non-programmer friends, slash it might make for a better separate post. SIM set up It was relatively easy to buy a Swisscom SIM card in the airport, although they did not offer to set it up in my phone for me.

Putting On Airs

Julia liked Eric. She wasn’t in love with Eric, she didn’t fantasize about marrying him or idly think about what their children would be like, but she liked him, an appropriate amount for having met him only two times. Internet dating was strange to her, and she knew that dating took work. And besides, it was a good sign she was mature enough to not feel those goofier feelings yet. She would instead be, appropriately, cautiously yet earnestly excited.

Operating Systems Part II: Modern Operating Systems

We use operating systems all the time in our life, whether designed for a computer, a phone, or for a server we’re more indirectly interacting with, but a lot of people don’t know very much about what connects the different systems we use, and what makes them distinct. We discussed fundamental concepts of operating systems in the last post, so in this post we will discuss how some of the same concepts apply to modern operating systems, going over them one at a time.

Music and Lyrics

I just finished singing Beethoven’s Missa Solemnis in a concert as a member of the Grace Church Choral Society, and it was the most technically difficult piece I have ever sung in a choir. It was a single piece of concert length, a mass setting, as is custom for our spring concerts. It was all in one language: in this case, in Latin. This is different from our holiday concerts in the winter, where we sing a variety of Christmas-y and otherwise celebratory works in a variety of (European, Christian) languages, including English.

What is an operating system?

A user of modern technology hears the term “operating system” thrown around a lot. Most people can name a few examples: Windows and macOS on workstations and laptops, iOS and Android on phones. Some people might even throw in Linux or Unix or ChromeOS. Most people also understand that a program or a game or even a sufficiently advanced website might work on some operating systems but not others, and might require different versions for different operating systems.

Soulfully

When Rajnish had agreed to mentor an intern, he was not expecting such a young girl. He was a little bit reassured when he was told how well Erica had done in college, that she was a “genius” — a dubious word, he would’ve preferred a “hard worker” or a “promising candidate” — but how could anyone deserve to be a junior in college at 17? She must be tricking everyone.

Is the US the only country?

A common trope within left-leaning American circles is to claim that the US is the only “developed” or “industrial” or “major” or “first world” country to not have X, where X is usually something like “publicly funded health care” or “government-guaranteed paid family leave” or similar. Recently this came up with Bernie Sanders and his common refrain that the US was the only “major” country to not guarantee health care as a human right.

The Bible, Me Too, and Lust

[Jesus said:] You have heard that it was said, “You shall not commit adultery.” But I say to you that everyone who looks at a woman with lustful intent has already committed adultery with her in his heart. If your right eye causes you to sin, tear it out and throw it away. For it is better that you lose one of your members than that your whole body be thrown into hell.

Function Pointers in C and C++

Programmers of functional programming languages will often point out that, in functional programming languages, the order of the arguments is often significant, because of currying. If you have a function that takes two arguments (e.g. map which takes a function to apply and a list to apply it to) it actually takes the first argument, and returns a function that takes the second argument and returns the final result. This makes it more convenient to write a lambda where the second argument is the unknown parameter: \x -> map someFunc x can be written as map f, whereas \f -> map f someValue has no such convenient shorthand (flip map someValue is actually clunkier).

Angels

The intern was nervous as she approached her boss, manila folder in hand. “Congresswoman Fischer,” she said, “I’m not sure I was actually supposed to see this document — I think it might be classified — but you did say you wanted me to look for examples of wasteful spending that might make for good PR…” Congresswoman Fischer waved the explanation away and then reached her hand out for the document.

Are you sure?

Mothers Against Drunk Driving, the local clergy, and the town council had been planning this concept for over a year. Finally they did it: Right in the town square, they installed a giant loudspeaker. From thenceforth, every two minutes, a booming voice would spread all over town, announcing “Are you sure?” Foolhardy decisions, they had decreed, would soon be a thing of the past. The locals seemed to adapt pretty readily.

India: Little Differences

Second collected thoughts on India. More Communitarian, Less Individualistic, Through Food and Beverage There is much less emphasis on individual choice. If you order tea (chay in Hindi) it will come with milk in it. If you order coffee, it will come with milk in it. They will not ask you how you want your coffee. Similarly, when I was in a cab ride between cities, I was not asked what food I wanted at the rest stop.

Adulting in India

The Way of NYC When I first moved to New York City, someone older and wiser than I gave me the following “rules” of New York City: Nothing is cheap. Nothing is easy. There are no exceptions to the first two rules. I found this to be extremely true in New York City. It was stressful and exhausting, and I was broke and living off an advance I’d gotten from my then-employer, living in AirBnB’s I could put on credit card, where I could maybe stay in each for a month, tops.

India: Zeroth Impressions

Everyone’s been asking me how India is and has been wondering if I’ve gone exploring. I haven’t really. Sunday I was just recovering from jetlag and yesterday I had work and then I immediately had to go home and crash I was so tired: so I guess again recovering from jet lag? This would normally not prevent me from exploring, but I’m honestly a little outside my comfort zone. I am not in a walkable neighborhood of a city like I expected, but next to a huge highway.