Should we ever stabilize inline assembly?

I both strongly agree and strongly disagree. :slight_smile:

In this case, the biggest relevant difference is that Rust has a very strong policy of keeping stable and unstable features clearly separate so that nothing ever becomes "de facto stable." In contrast, C++ had multiple competing implementations for years before there even was a standard, so for a long time "de facto standard" was the only kind of standard there was. In practice, a Rust nightly-only feature feels like a much lower status than a "de facto standard" C++ feature; it's probably reasonable to say the former can break at any time but the latter really can't (if only because a major C++ compiler dropping something like inline asm would be utterly suicidal).

But as usual, we can make our comparisons apples-to-apples simply by being a lot more specific:

  • Do the most heavily used, battle-tested, well-maintained implementation(s) of the language with a strong support system and backwards compatibility guarantees provide inline assembly? For C++, yes. For Rust, no.
  • Does the formal specification of the abstract machine that defines the language provide an inline assembly feature, optional or otherwise? For C++, no. For Rust, no (and not just because Rust has no formal spec).

When people say things like "inline asm is a foundational feature of a systems language", I assume they're after something closer to the first bullet point. In particular, I think the kind of claim they're really getting at is that:

Rust should be an ideal language for implementing operating systems, device drivers, and other kinds of software that cannot be written without inline assembly. But because stable Rust lacks inline assembly those entire application domains are closed off to it. That is a serious problem, and addressing it should be one of our highest priorities.

And this claim still seems plausible to me, even after reading the >100 posts in this thread. Of course, I am putting words in other peoples' mouths right now, which is always a bit risky, but hopefully this helps break down the communication impasse I'm sensing here.

15 Likes