What is the essence of Rust?

... that seems to be controversial these days.

Well — I've been thinking about that a lot lately and I want to share my thoughts with you.

But before I start, let me tell you this. I've observed that posts which advocate to play Rust just for fun often get deleted. Why? Is this such an earnest place?.. So, if some admin is already hovering over the delete button (I can see you!), let's put our differences aside and please hear me out. Thank you! :vulcan:

So what is Rust to me?

We all seem to agree that Rust is multi-platform and you can, well, play it safe. But is that really fun??

No. :slight_smile:

Many say it has a friendly, safe and welcoming environment and community. Hm, they obviously never engaged in real PvP! Lol.

In fact in Rust you have to run blazingly fast to guarantee threat safety. But whether your runtime will always be minimal - as some folks keep suggesting - really depends on your condition though. You just need to practice and only trust your own benchmarks. Your runtime will improve - that's guaranteed.

Some people suggest to study move semantics first... If you keep loosing data races, you could try that too -- it may sound a bit abstract at first, but hey, it's zero cost!

Rust supports a lot of hardware .. but I'll tell ya, don't expect a good framerate from a cheap system. It's absurd that so many people are even thinking about running Rust on RasPies or even in a browser (doh!).

Even more esoteric theories suggest codes in Rust. I had a look at these so called codes and think they are a myth. Believe me, they won't help you against anything larger than a bug anyway, even single-threated. Harhar. :wink:

But I'll be honest with you: Community is indeed the most fun part of Rust to me. That's why I'll do Rust with everyone of you. Even if you believe in exhaustive pattern matching. Lol.

Anyway.

What is Rust to you?

1 Like

For me it's mainly one thing: a viable replacement for C.

Like C, it's a natively-compiled, no GC, minimal-runtime language with (mostly) fine-grained control of memory layout that produces C-compatible libraries without fuss, so I can use it without many "ifs" and "buts".

And unlike many attempts to improve/replace C before, it does offer enough improvements in both safety and ergonomics to be worthwhile.

5 Likes

Before getting into my response, can I just say to @justgarry that I commend your efforts to weave a video game pun joke into an interesting question about a programming language? Really, good on you!

To answer the question of "what is Rust to you?" I think I'd summarize like so. To me, Rust is a movement. Let me explain.

Many of us have extolled the virtues of Rust as a systems-level, memory-safe programming language capable of being applied to everything from operating systems to web application frameworks. We've extolled the wonderfully pleasant, intelligent and helpful community. To me, Rust is all of these things but, ultimately, actually greater than the sum of its ("tangible") parts.

Rust rejects so much of what developers, including myself, have come to expect from anything related to computer programming. Rust rejects the notion that one cannot have both an expressive and safe programming language as well as blazing fast performance. The Rust community rejects the norms of dispassionate arrogance that had for many years been prevalent in so many other programming communities. To me, Rust and everything around it right now says "we certainly aren't perfect, but we can most definitely do better, and being better is worth the effort," and the Rust community has and continues to put in the effort.

I sincerely believe that, no matter what happens to Rust the programming language in the coming decades, it and this community will have forever changed the way we write software, the way we design programming languages, the way we work together and, most importantly, the way we treat people. I feel proud to contribute to these things in whatever small ways I can and sincerely believe that Rust is the future of programming.

7 Likes

+1 to both of the above comments.

It also appears to be a viable replacement for C++ for me. I was an immediate convert to modern C++ (C++11/14/17/GSL) when it arrived. So much more safety came from just thinking cleanly about code design. I thought "that's it!" "there's nothing left to be invented in the universe--I have std::unique_ptr" and enjoyed waving giddily at all the GC languages as my code sped by.

But a funny thing happened on the way to the store. Borrowck came and knocked me out--not in that bad way that you hear about as a rite of passage in Rust, but more like that attractive person you can't quite stop stealing glances at...

But I had to know if there was substance behind the pretty promises. I've got very serious work to do, where lives will actually depend on correctness (electric car control systems) and a technology like Rust promises safety, elegance and speed. Every bit of help in the safety department is welcome--it almost seemed too good to be true!

(Whose brainchild was borrowck, anyway? Did Graydon come up with this all on his own, or was it ahem mutably borrowed from another language? Inquiring minds...)

Approx. 6 weeks in I can say Rust, despite having dished out some tough love, hasn't disappointed yet. I can see it replacing several languages I currently use, and not just in the (embedded) systems space.

Much <3 to the supportive and friendly Rust community. The journey has been a real treat so far.

For me, Rust was never as much about the details of how it reaches its goals. The type system is interesting, it doesn't shy away from asking people to learn some difficult concepts... but it could have done all that as a research language.

What I loved about Rust from the beginning to now is that people wanted to build it as a language meant for production. It always felt to me like a project that wasn't about advancing theory, like Haskell and Idris are in some ways, but more one that wanted to bring theory into production, from the beginning on.

4 Likes

Rust promises to panic. For most software this is a great improvement. Any hacker won't be exploiting all too common memory mismanagement issues to take over computer system. Safety critical systems (when done right) have to be correct no matter what is input; which requires much more time than typical software development is willing to pay.

(p.s. I look forward to seeing the t-shirt that will make a self driving car crash.)

Rust promises to panic

If (when) the programmer asks or messes up, true. But the class of errors/mistakes it eliminates is really quite incredible. I wouldn't be shocked if careful Rust code was 100x safer than careful modern C++.

t-shirt that will make a self driving car crash

Hmmm... Not sure I want to see that T-shirt, unless the crash is in the lab... :slight_smile:

This. I'm sure D is better than C++, but it never seemed worth switching to. But a & that the compiler proves is actually what I always wanted const & in C++ to be? :heart:

It is solution for many and many annoying problems of C/C++:

  1. Integer promotion and over rules that applied for implicit types conversations
  2. Exception and return codes - choose one, and then deal with external library
    that make another desicion
  3. Usage of external libraries. It is nonsense, from my point of view, that some patches
    not merged into open source library, becuase of after that it can become not one header library which reduce community of library
  4. I already mention implicit rules, but again implicit, implicit, implicit. Calling of constructor/operator=, who own data, who free data, after c++11 you get speedup
    of code, thanks for move constructor, but at now you should care about move or copy
  5. CI run tests compiled with -fsanitize=, run it under valgrind, but you still
    have seldom random crashes inside huge third party. And to deal with them
    you need first of all fix undefined behaviour of this third party library. Becuase of
    Qt guys not care about this, because of underfined defined for certain compilers,
    and they never run code with -fsanitize=