iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
📑

Why Rust Continues to Be the Most Admired Language on Stack Overflow

に公開2件

Introduction

For the past several years, Rust has consistently been ranked as the "Most Loved / Most Admired Language" in the Stack Overflow Developer Survey.

On the other hand, we often hear the following about Rust:

  • It seems difficult and unapproachable
  • It has a high learning curve
  • It is slow to write

Even so, why does the result that "those who have used it rate it the most highly" continue to appear?

In this article, I will categorize the reasons why Rust has become a language that "people say they want to continue using" rather than just a "trending language," from the perspectives of language design and developer experience.

What is the "Most Admired Language"?

In the Stack Overflow Developer Survey, apart from simple usage rates, the following question is asked:

I want to continue using this language next year.

In other words, "Most Admired" refers to a language that:

  • Has actually been used
  • Has a high percentage of people who responded that they want to continue using it next year

It is not a ranking for beginners, nor is it a ranking based on hype.

"A language that people who have used it properly choose again."

The fact that Rust has been at the top of this list for many years is quite suggestive.

References

Reason 1: Compile-time safety is not an "ideology" but an "experience"

Memory safety is the first thing that comes to mind as a feature of Rust.

However, what is important is the point that:

Rust is not "safe if you are careful," but
"pretty safe if it compiles."

Differences from other languages (broadly speaking)

Language How to deal with bugs
C / C++ Notice it when it crashes at runtime
Java / Go Detected as an exception at runtime
Rust Stop as an error at compile time

Rather than "finding" problems like NULL references, use-after-free, or data races in tests, you ensure they "cannot be written in the first place."

This sense of security is greater than one might imagine once you start using it.

Reason 2: The compiler becomes a "partner" rather than an "enemy"

When people start using Rust, what confuses many at first is the sheer number of compile errors.

However, if you read those error messages carefully, they explain:

  • What is happening
  • Where the problem occurred
  • Why it is not allowed

quite thoroughly.

Even on the official Rust blog, it is described as follows:

The compiler is a teacher, not just a gatekeeper.

Even if it feels strict at first, as you get used to it, it becomes more like a "presence that reviews your code."

References

Reason 3: Design based on large-scale and long-term operation

Rust is designed from the ground up with the following worlds in mind:

  • OS
  • Browsers
  • Databases
  • Embedded systems

Therefore, it includes "constraints" such as:

  • Ownership and borrowing
  • Immutability by default
  • Powerful type system

The true nature of Rust's "difficulty"

✖ Meaningless complexity
◯ The cost to prevent accidents before they happen

I believe that for many, this changes how they view Rust.

Reason 4: The code you write helps your "future self"

Rust code has features where:

  • Types become the specification itself
  • There are few implicit rules
  • It is easy to follow the intent even when read years later

As a result, satisfaction tends to be high in:

  • Team development
  • OSS
  • Projects premised on long-term maintenance

I think the fact that it is not just "code that runs now" but "code that remains valid in the future" is also a reason for its high rating.

Why is it "loved" instead of just "popular"?

To be honest, I don't think Rust is an easy language.

  • High learning curve
  • Slow to write at first
  • No casual feel

Yet, the reason it continues to be supported is clear:

Rust is not an "easy language"
but it is a "language that won't betray you."

Once you realize the sense of security that Rust provides, it makes you want to "choose Rust again."

Summary

The reasons why Rust continues to be chosen as the Most Admired language on Stack Overflow include:

  • Safety guaranteed at compile time
  • Error messages that support learning
  • Language design premised on long-term operation
  • The fact that the code you write remains valid in the future

It is not because it is trending, but rather the result of "the people who have fully used it evaluating it highly."

References

Discussion

mpywmpyw

実際 Rust の恩恵をプロジェクトで感じたことはあるので、概ね内容には納得しつつ、敢えて(難易度面以外で)批判的な意見を書くと

  • マクロ偏重のライブラリ選定をすると、コンパイルが著しく遅くなる
    • このへんは Go みたいな思想で、適度に Git 管理するファイルとしてコード生成すべきです
    • もしくは Rust のキャッシュ機構がもう少し賢くなる必要があるかなと思ってます
    • 例として async-graphql ぐらいマクロに全てを任せるのは、かなり時期尚早かなと感じました
  • バグを減らすためのガードレールと言いながら、非同期処理満載の Web プログラミングでは足枷になる部分のウェイトが重い
    • 純粋ドメインを作り込むところでは所有権モデルが大いに活躍してくれるとは思います
    • 非同期処理が絡む部分には、どうしても動的ディスパッチがついて回ります。複数段の await を持つステートマシンを dyn 無しの Future で表現することは困難であり、「所有権モデルさえ無ければもっとシンプルに書けるのに…」と思うことは多々あります
    • Rust の管轄外にあるデータベース絡みの不整合を前にすると、所有権のお守りも無力になることがあります。実際にプロジェクトで所有権を過信した結果、トランザクション不整合のバグを生んでしまった身としては…
    • Rust の素晴らしい文法を取り入れながら所有権を放棄して GC に倒した MoonBit という強力なライバルも現れましたし、この先は用途を選んで差別化していくことが重要になりそうです。
1
どぅくしどぅくし

実務的な意見、本当に貴重で助かります…!

書いていただいている内容、読んでいてとても勉強になりました。

マクロ偏重によるコンパイル時間や、非同期処理が増えたときの設計・実装の重さは、
確かに実際にプロジェクトで向き合わないと見えにくい部分だなと感じました。

所有権モデルがきれいにハマる領域とWebやDB周りの境界で急に難しくなる感じについても、
「Rust だから安心」と思いすぎない視点の大切さを改めて考えさせられました。

MoonBit の話も含めて今後は「Rust かどうか」より「どこで使うか」という点を意識していきたいと思います!

共有ありがとうございます!

1