Graydon Hoare Remembers the Early Days of Rust
In Late May Rust‘s creator, Graydon Hoare, took a look back at the early days of Rust on his personal blog. Hoare started by reminding readers that “I haven’t been involved in the project for a decade,” so “I think anything I say needs to be taken with a big grain of salt, but I do keep up somewhat with the comings and goings…”
Rust started as Hoare’s personal project in 2006, later attracting many more contributors and Mozilla’s official sponsorship in 2009, according to a recent history published by MIT Technology Review.
In two back-to-back blog posts, Hoare offered at least a few quick glimpses into how a programming language evolves. Interestingly, the second post was titled “The Rust I Wanted Had No Future,” and toward the end Hoare writes succinctly that “Divergence in preferences are real! My preferences are weird. You probably wouldn’t have liked them.”
It all provides a fascinating look at some quirks that got ironed out along the way — and how the early days of a language can differ from its present-day incarnation…
Back to the Future
Hoare’s personal blog covers a wide variety of topics. In 2023 he’s written four posts, the first about amateur ham radio and then corporate-employed maintainers with bad incentives for open source contributions (when instead those employers should just”let maintainers be maintainers.”)
But Hoare shared some quick thoughts about Rust in the next two posts. The first post shared a recent question to Hoare: “Do you ever wish you had made yourself Benevolent Dictator For Life of the Rust project?” And would there be less drama on the project if he had?
“No,” Hoare answered both questions. Hoare added further down that “I don’t like attention or stress, I was operating near my limits while I was project tech lead back in 2009-2013… Additionally, I’ve no reason to believe I would have set up strong or healthy formal mechanisms for decision making, conflict management or delegation and scaling.”
But then that post turned up in Reddit’s Rust subreddit, where Hoare is a sometime contributor. To a user asking if Rust development was slow, Hoare once responded “In terms of major features, it’s good for it to slow down.”
In the discussion on his own post, Graydon had commented, “Just don’t get me started on angle brackets for type parameters and the single apostrophe for lifetimes!”
One Reddit user insisted on following up. Hoare clarified that “they were just syntax arguments I was on the losing side of.” And he even supplied a link to his “Rust prehistory” GitHub repository, showing 13-year-old Rust code where square brackets had actually been implemented for type parameters, adding that “I personally think square brackets are the obvious choice for type parameters.”
Hoare was also opposed to explicit lifetimes for references, and “was talked into them as ‘something that will almost always be inferred so it doesn’t matter what the syntax is, nobody will ever write them’. Obviously that .. didn’t quite happen.” Almost as an afterthought, Hoare wrote in his Reddit comment, “I should probably do a blog post someday ‘the Rust I wanted’ and clarify both that (a) the Rust we got is fairly far from the one I wanted on quite a few axes and (b) making that observation in no way detracts from my feelings of overwhelming gratification at the success of the language!”
Days later Hoare did write that blog post, emphasizing that the Rust he’d wanted “would probably have been extremely unsatisfying to everyone involved, and it never would have gone anywhere…
“[D]on’t get me wrong: like the result. It’s great. I’m thrilled to have a viable C++ alternative, especially one people are starting to consider a norm, a reasonable choice for day-to-day use. I use it and am very happy to use it in preference to C++. But…!”
In the post, Hoare includes a list of “just a few of the places I literally didn’t want, and/or currently don’t like, what Rust wound up with.” For example, in his “Complex Grammar” section, Hoare complains Rust is still hard to parse. “It’s easier to work with than C++, but that’s fairly faint praise. I lost almost every argument about this, from the angle brackets for type parameters to the pattern-binding ambiguity to the semicolon and brace rules to … ugh I don’t even want to get into it. The grammar is not what I wanted. Sorry.”
Another example: the way Rust handles types. Hoare prefers “structural” typing (where objects have compatible types if their structure is the same — regardless of whether they’ve been declared with the same type name). Hoare also reveals that “the language initially had (and I hoped it would have again) complier-emitted ‘type descriptors’ that the user could invoke a reflection operator on.”
Hoare also had some thoughts on how Rust handles decimal floating point numbers. “[B]asically every language discovers the long way that financial math is special and, at great length, eventually adds a decimal type. I wanted Rust to do this upfront, but it was perpetually deferred to libraries. There are a few, but it’d be better to have one built in…”
There were more examples, but Hoare wasn’t trying to enumerate specific differences between his vision and The Rust We Got. Instead, “The point is to indicate thematic divergence.
“The priorities I had while working on the language are broadly not the revealed priorities of the community that’s developed around the language in the years since,” Hoare writes, “or even that were being revealed in the years during.
“I would have traded performance and expressivity away for simplicity — both end-user cognitive load and implementation simplicity in the compiler — and by doing so I would have taken the language in a direction broadly opposed to where a lot of people wanted it to go.”
Hoare even provided specifics:
- “A lot of people in the Rust community think ‘zero cost abstraction’ is a core promise of the language. I would never have pitched this and still, personally, don’t think it’s good. It’s a C++ idea and one that I think unnecessarily constrains the design space… I would have traded lots and lots of small constant performance costs for simpler or more robust versions of many abstractions. The resulting language would have been slower.”
- “Similarly I would have traded away so much expressivity that it would probably make most modern Rust programmers start speaking about the language the way its current critics do: it’d feel clunky and bureaucratic, a nanny-state language that doesn’t let users write lots of features in library code at all, doesn’t even trust programmers with simple constructs like variable shadowing, environment capture or inline functions.”
Perhaps in a fittingly ironic coda, when the blog post turned up in Reddit’s programming languages subreddit, it attracted a mix of responses. One user even commented, “I really wish the Rust he wanted existed, it sounds beautiful.”
But another commenter seemed more rooted in the reality of today. “His Rust wouldn’t have been better, it would have been different…
“I really like today’s Rust… I love performance/pedal-to-the-floor code, and today’s Rust offers me that in a nice package.”