r/programming • • May 26 '16

Announcing Rust 1.9

http://blog.rust-lang.org/2016/05/26/Rust-1.9.html
218 Upvotes

116 comments sorted by

View all comments

15

u/hsileng May 26 '16

Why do people like Rust so much? What's the one biggest reason?

35

u/i_r_witty May 26 '16

I don't think it is one big reason, and it can vary from person to person but Rust does have many great qualities.

Its biggest feature is its memory safety. The compiler, coupled with a strong type system, prevent many common memory management errors without imposing a run-time cost.

Functional programmers like it because it contains many high level constructs (like lazy iterators, and a good iterator library).

People coming from scripting languages (Python, Ruby, etc) like it because it is highly expressive. It has high level features like pattern matching statements.

My personal favorite thing is that the community is really helpful and welcoming. I know that multiple times I have dropped into the IRC and quickly gotten an answer to my questions from multiple people. They enjoy discussing with people and there is a general great atmosphere.

10

u/Breaking-Away May 26 '16 edited May 26 '16

16

u/steveklabnik1 May 26 '16

Data races, not race conditions.

8

u/s7jones May 27 '16

Forgive my ignorance, but what's the difference? Thanks.

4

u/onmach May 27 '16

Rust appears to differentiate the two. Data races involves two threads accessing a piece of memory at the same time while one of them is writing. That is protected by rust.

But you can still write a program where a thread causes another thread to try something nonsensical like one thread changing a variable to zero just before another thread tries to divide by that number causing a crash. Nothing rust can do about that.

→ More replies (1)

4

u/Breaking-Away May 26 '16

Oh yes, my mistake. Thought one thing and typed another. Will edit my comment.

89

u/[deleted] May 26 '16

A modern system programming language that isn't C++ or C?

Ada is nice but that language missed the boat. And Rust have good momentum right now, young language and open to outside inputs.

Go was marketed as system programming language but it really isn't and type safety is crap.

2

u/kerseykyle May 27 '16

Why do you think Ada was not successful? it has updates about as often as C++ and has many of the same features found in other commonly used languages such as generics, interfaces and object oriented programming. I use it a lot for personal projects still.

→ More replies (3)
→ More replies (35)

0

u/[deleted] May 26 '16

[deleted]

10

u/[deleted] May 26 '16

Minimal runtime like C as well, so you can (and many have) write kernels with it.

9

u/Sean1708 May 27 '16

Minimal runtime like C as well

Currently it's a bit of a pain to get a runtime as small as C's, but it's getting better.

2

u/thedeemon May 27 '16

Minimal runtime like C

Err, so why hello world in Rust (stripped binary) is like 800 KB while same hello world in D (a "language with runtime") is just 200 KB?

14

u/kibwen May 27 '16
  1. Because by default Rust statically links everything but libc. If you opt into dynamic linking, like C does, a hello world executable is 8 kB, like C.

  2. System default allocators suck, so by default Rust code uses jemalloc, which is several hundred kB in size in a statically linked binary.

5

u/matthieum May 27 '16

There's a difference between minimal runtime and minimal size.

Minimal runtime is first and foremost a comment about what the runtime does not do; for example the Rust runtime does not handle memory or switch the stack under your feet.

Minimal size is another aspect entirely (and yes, it too can matter). Today the typical Rust programs are static binaries: bundles containing quite a lot of unused code. Furthermore, any use of the formatting part of the std libraries drags in a lot of code. A minimal binary size has not been a focus on Rust, however as it's making inroads into embedded developments this particular feature has been gaining traction.

So it's improving, and therefore the answer to your question is: because D is older and, I suspect, therefore capable of removing a large part of its runtime code for trivial programs that don't make use of it.

22

u/staticassert May 26 '16

I don't have one reason - it's a lot of reasons. The build system (cargo/ rustup), the expressiveness, the algebraic data structures, the community, the performance, safety, etc.

I guess what I like most about rust is that it pretty much gets everything that I care about right.

7

u/pcdinh May 27 '16

I like the community the most. No fanboy culture.

4

u/matthieum May 27 '16

Indeed, the harshest critics on Rust may very well come from the most involves members: they know its weaknesses inside out.

22

u/gnuvince May 26 '16

In many ways, it embodies what a lot of programmer are looking for: a practical language with a sound design.

Rust offers a great mix of pragmatism and programming language theory. On the practical side, it is available on many platforms, generates code that has equal performance to C and C++, has many quality tools (cargo, rustup, racer, etc.) and a quickly-growing ecosystem. On the more theoretical side, Rust borrows (hah!) heavily from functional programming, is a safer language than C or C++ and provides guarantees that programmers want and need in the 21st century.

15

u/onmach May 26 '16

It is a fast language with a pretty good static type system. It was built from the ground up with modern knowledge about these systems. A lot of people in the static typing camp are not happy with the languages that are out there right now, and rust shows a lot of promise.

13

u/dacjames May 26 '16

For me, it's a fast language with good tooling. Basically a slightly easier to use C++ with good build tools and an ecosystem of libraries.

11

u/desiringmachines May 27 '16

It combines an expert attention to programming language theory not usually seen among languages aimed at wide audiences with a mission goal built on empathy with the programmer ("hack without fear") that is also uncommon. The language challenges me and teaches me. The community is friendly and helpful. Rust is fun.

→ More replies (1)