So how can all of this happen? Well, safer systems languages like Rust can help, but another approach is to remove the mutation entirely. If we could have a practical language which was built around immutability, we'd have thread safety by default. So I found Clojure and thus began my foray into lisps and functional programming. After spending a while completely baffled, things began to click. I would thing of each of my tasks as a series of pure data transformations instead of a class + members + methods to mutate those members. It was data in, data out. Alas, none of my colleagues were so interested, and I was still their go-to C++ guy for anything non-trivial. So why was the "C++ guy" giving talks about referential transparency?
Ultimately, I had had enough. To me, though I had spent several years building an encyclopedia of C++ knowledge, the state of things didn't seem practical. Not if we wanted to take full advantage of parallelism. Not if we wanted to feel confident in the safety of our code at compile-time. I gave a final talk at my day job, regarding C++ value categories. It's a nasty subject and a deep dive into something many professional C++ developers still don't grok. Ironically, I wrote it in Clojure and it became the go-to cheat sheet for everything value category in C++14 and before: https://github.com/jeaye/value-category-cheatsheet
So, finally, we're still left with the incomplete journey: Clojure's type system. Alas, there's nothing to be done about that. Similarly, as someone who enjoys game engine development, kernel development, and other systems work, Rust is likely the best option for me there. However, it's not functional-first. It doesn't have persistent, immutable data structures (which trade data locality for thread safety; a worthy trade in many cases) in the stdlib. We have other functional languages which do have much stronger type systems, but, in my humble opinion, they often lack the practicality of Clojure. Adhoc side effects, s-expressions (very little syntax), and utter simplicity.
That's why I've been working on https://github.com/jeaye/jank for a few years. It's slow going, but I want it to be a statically typed Clojure dialect, basically, which compiles to native code. Similar to Clojure's spec, jank should allow folks to start with a baseline of data transformations and then build up stronger type checking after things are in place. The big difference is that jank isn't dynamically typed at all; its baseline is much more secure and the additional validations which can be presented at compile-time are akin to dependent types. So, static typing, functional-first stdlib with immutable data structures, s-expressions (Clojure-compatible syntax), gradual dependent typing, and a compilation target of LLVM. To me, that's the dream.
As a last addition, trying to write C++, or most any similar language, these days is quite upsetting to me. I no longer have a taste for it.