Back in undergrad, I taught myself UNIX from the DEC 3100s, and C from K&R, when I should have been doing physics homework. I also sat in on a C++ class with @edward_smyth because taking an uncredited module in final year sounded like a GREAT idea at the time. 1/
Yes, I did get my maths&physics degree, and my programming experience led me into a postgrad world of computational numerical analysis, which led me into a career in IT systems security. No regrets.

I also spent a summer developing in C++, rather badly as it turned out. 2/
See, C++ is a horrible programming language, full of gotchas, wanton featuritis, and memory leaks. I spent more time developing in Fortran 90, an elegant language from a more civilised age. Less featureful, but only one real gotcha: column-first array memory layout. 3/
I hacked around in perl: come for the flexibility, stay because you got lost in the obtuse syntax. I studied Ada, but never put it to use. I built a web application in Ruby on Rails, and grinned like a loon - until they introduced breaking changes and destroyed my code. 4/
I printed out and bound the entire Java manual, but “public final static” drained my enthusiasm, and garbage collection is a kludge. 5/
My dreams were haunted by another language, one which did not yet exist. It had type inference, eschewed inheritance, and managed memory in the compiler by use of strictly scoped reference typing. It was type-safe, and fast, and avoided all the mistakes of other languages. 6/
But I didn’t have the experience to implement it, and it rattled around in the back of my brain for two decades, gathering new ideas like moss but never progressing.

Then this year I decided to buy myself an early christmas present. 7/
I had been meaning to learn one of the more modern languages
for some time. Haskell is too abstruse, and I couldn’t get my head around OCaml. Python gets rave reviews, but the v2-v3 migration is a decade-old, still-ongoing shitshow. 8/
I looked into Go, and know people who like it, but it didn’t grip me.

So I bought a book on Rust. 9/
From what little I had read, it sounded like someone had tried to make a better C++. Such things already existed (D?) but Rust was taking off among serious developers. Reputable people were implementing cryprographic primitives in it. It had to be the real thing. 10/
So I bought the book and spent most of christmas reading it, start to finish, with growing amazement.

These ingenious bastards have implemented *my language*,
the one that has haunted my dreams for nearly 25 years. 11/
It implements the solution to on-heap scoping (“lifetimes”) that always eluded me. It’s more intricate than I thought but it’s the correct one. Its unsafe blocks also provide the necessary glue between safe high-level code and the underlying unsafe machine representations. 12/
It doesn’t do everything I hoped for in my language, of course. It’s a little too wedded to clunky C++ syntax conventions, but if your target market is C++ developers then there’s a logic. It also uses a bonkers “half-open range” convention for incomprehensible Reasons. 13/
I cannot overstate just how insanely wrong half-open ranges are, just as I cannot overstate how insanely wrong Python’s use of meaningful whitespace is. But every language is allowed one mistake. Just one. 14/
(Fortran’s is column-first array memory ordering, as discussed above) 15/
Gripes aside, Rust is a phenomenal achievement. It’s a gold-standard programming language, and you should stop using C++ *right now*. If (and only if) you’re writing device drivers you can continue to use C. Otherwise Rust is the new baseline. 16/
Is this the end for the language of my haunted dreams? No, for a few reasons. Firstly, it has meanwhile accumulated greater ambitions. Secondly, I know how to eliminate most off-by-one errors (and those ridiculous half-open ranges). 17/
Also, it was always intended as a transpiling language, one that would not compile directly to assembler, but to an intermediate language such as C. I have no intention of writing a compiler, others can do that job better than me. 18/
A well-designed transpiling language should be able to target more than one intermediate language. The same program could run as compiled Rust, or JVM bytecode…

Or as a posix shell script. It would run like toffee, but it would run. 19/
Different modules in the same project could target different paradigms, some bits as shell code to run on remote hosts via ssh, some inside tomcat, some modules in the browser, some as machine code.

nodejs on steroids, but based on a grown up programming language. 🙃 20/
It’s called Stibium, and it’s going to stand on the shoulders of giants. 21/
You can follow @andrewgdotcom.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.