It's kind of a requirement if they hope to replace C/C++ as a systems language, as those remain the goto answer for "I need maximum control", short of assembly.
And they want to replace C/C++ to fix all their safety problems.
I work in embedded systems, where C remains a holdout, with all its problems. Rust's performance-oriented direction makes it a viable consideration for us.
My understanding of zero cost abstractions is that they predominantly happen at compile time (and thus commonly appear in language semantics or the type system) and literally cost nothing at runtime. This has other costs like semantic complexity, but almost never performance.
Regardless, I don't buy that Rust couldn’t present a more opinionated and complete programming experience without allowing the same performance characteristics that it has today. The whole async situation is awful. Lifetimes are a stupid leaky abstraction 99% of the time. My point is that there’s almost never a scenario where you e.g. need to bother with passing around a struct with a reference with a lifetime. 99% of the time you just take ownership of the data or use an Arc<Box<T>> and 99% of the time that’s not a performance problem. What I think is stupid is that Rust elevates and enshrines the 1% use cases and makes the 99% experience worse off for it. I love Rust. But it could do a better job of solving the 99% cases nicely while allowing a “zero cost escape hatch” where you could say “actually I do want a stack allocated reference without atomic reference counting” and pay the semantic price 1% of the time rather than 99% of the time, Similar to Swift’s approach.
Obviously my experience had been shaped by the projects I’ve worked on. But I also think Swift is an entirely more ergonomic and practical language. If you think Rust is a viable option then, unless you’re anti-Apple, Swift with move semantics is too. Seriously.
- you only pay for what you use
- if you use it, you couldn't implement it better yourself
There's no such thing as literally zero cost, obviously.
Graydon was saying that even this fairly reasonable pair of conditions got in the way of some nicer abstractions.
Then I thought that what we really need is a Swift-like language with the ability to remove costly abstractions when you don't want to pay the cost, but that default to ergonomically solving the problems that the majority of programs need to solve. You should opt-in to more semantic complexity, not be encumbered by it by default. Rust's obsession with performance above all else confuses me. But I also guess it's nice to have a safe space for performance sensitive programmers. But like how can a systems language not have a stable ABI? Very mixed messages.
Ultimately this "Rust with better ergonomics" language could be Swift. I do think it is more usable across platforms than people give it credit for. But it's also missing the "let me dip down into lower level but more complicated semantics when I need to" option. Having a stable ABI is awesome, though. I really can't wait for the day where I can start a portable project in Swift without a second thought.