Stories
Slash Boxes
Comments

SoylentNews is people

posted by hubie on Monday February 20, @10:01PM   Printer-friendly
from the feel-like-a-magician dept.

For decades, coders wrote critical systems in C and C++. Now they turn to Rust:

Many software projects emerge because—somewhere out there—a programmer had a personal problem to solve.

That's more or less what happened to Graydon Hoare. In 2006, Hoare was a 29-year-old computer programmer working for Mozilla, the open-source browser company. Returning home to his apartment in Vancouver, he found that the elevator was out of order; its software had crashed. This wasn't the first time it had happened, either.

Hoare lived on the 21st floor, and as he climbed the stairs, he got annoyed. "It's ridiculous," he thought, "that we computer people couldn't even make an elevator that works without crashing!" Many such crashes, Hoare knew, are due to problems with how a program uses memory. [...]

Most of us, if we found ourselves trudging up 21 flights of stairs, would just get pissed off and leave it there. But Hoare decided to do something about it. He opened his laptop and began designing a new computer language, one that he hoped would make it possible to write small, fast code without memory bugs. He named it Rust, after a group of remarkably hardy fungi that are, he says, "over-engineered for survival."

Seventeen years later, Rust has become one of the hottest new languages on the planet—maybe the hottest. There are 2.8 million coders writing in Rust, and companies from Microsoft to Amazon regard it as key to their future. The chat platform Discord used Rust to speed up its system, Dropbox uses it to sync files to your computer, and Cloudflare uses it to process more than 20% of all internet traffic.

[...] Many of the tricks Rust employed weren't new ideas: "They're mostly decades-old research," says Manish Goregaokar, who runs Rust's developer-­tools team and worked for Mozilla in those early years. But the Rust engineers were adept at finding these well-honed concepts and turning them into practical, usable features.

As the team improved the memory-management system, Rust had increasingly little need for its own garbage collector—and by 2013, the team had removed it. Programs written in Rust would now run even faster: no periodic halts while the computer performed cleanup. [...]

[...] "It's enjoyable to write Rust, which is maybe kind of weird to say, but it's just the language is fantastic. It's fun. You feel like a magician, and that never happens in other languages," he says. "We definitely took a big bet—it's a new technology."

Some firms were discovering that Rust eased their terror about memory bugs; Mara Bos used Rust to completely rewrite her company's software for controlling drones, which was originally written in C++.

[...] All that old C and C++ code that's already kicking around won't vanish; it'll remain in use, likely for many decades. But if Rust becomes the common way to write new code that needs to be fast and bare-metal, we could begin to notice that—very gradually, year by year—our software landscape will grow more and more reliable: less crash-prone, less insecure.


Original Submission

This discussion was created by hubie (1068) for logged-in users only, but now has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 5, Insightful) by rpnx on Monday February 20, @10:12PM (6 children)

    by rpnx (13892) on Monday February 20, @10:12PM (#1292784) Journal

    Calling rust "the most popular programing language" is false. The article/summary is lying. People that use Rust often like it, yes. But if you properly control for all factors I don't think Rust is really that popular. Consider the number of programmers that prefer C++ over Rust, and the number is quite a bit higher. Only when you look at % of people using Rust that like it, vs % of people using C++ that like it, does Rust come ahead. This is obviously biased by the age of C++ and number of legacy projects. This isn't a good argument and is either idiotic or frivolous, or both. Second note, this article puts a pretty positive spin on Rust. Seems to be part of this Rust hype. I'm not so sure how a language driven by a single organization is going to replace one driven by a standards committee. There are applications that might benefit from Rust, particularly those that would otherwise be written in Go or C, but I don't think Rust is a great C++ replacement. I think the niche that Rust carved is that it is able to provide a C++ level of performance in a C/Go style package. But if you want to write complex algorithms in a trading system, I highly doubt that Rust would be your first option. Besides, Rust is too x86 focused. ARM etc. exist and we need undefined behavior and memory orders, etc. to get the best performance out of them. Rust is easier but not better than C++.

    • (Score: 4, Interesting) by DannyB on Monday February 20, @10:19PM (3 children)

      by DannyB (5839) Subscriber Badge on Monday February 20, @10:19PM (#1292787) Journal

      Rust is too x86 focused

      Interesting. Please elaborate. I would like to know more.

      I tend to think of high level compiled languages being translated into machine instructions. So I'm curious how Rust is different than how I perceive compilers and languages I have used in the past.

      Is Rust taking advantage of, or depending upon some Intel quirk?

      --
      How often should I have my memory checked? I used to know but...
      • (Score: 5, Informative) by rpnx on Monday February 20, @11:06PM

        by rpnx (13892) on Monday February 20, @11:06PM (#1292791) Journal

        Rust avoids a bit of undefined behavior by defining certain things to work the way x86 works. Great on x86, not so great elsewhere where multiple instructions are required to get the same behavior. The compilers for Rust also just lack a lot of backend targets that are available for C++ compilers.

      • (Score: 5, Informative) by rpnx on Monday February 20, @11:18PM (1 child)

        by rpnx (13892) on Monday February 20, @11:18PM (#1292793) Journal

        At least according to this:

        https://github.com/rust-lang/rust/issues/45239#issuecomment-336470343 [github.com]

        Rust is supposed to use the x86 (modulo) behavior as opposed to e.g. ARM behavior (truncate)

        • (Score: 5, Interesting) by shrewdsheep on Tuesday February 21, @08:06AM

          by shrewdsheep (5215) on Tuesday February 21, @08:06AM (#1292849)

          Anecdote: I used to develop under OpenSTEP which made it through a transition from 68040 to x86. I had some bit-mask generation macro: (1 (bits)) - 1 which was suddenly broken under x86 as there is an implicit modulo: (1 ((bits) % 32) - 1. Curiously, whenever I stumbled on such implementation differences, Intel made the wrong choice IMO (maybe just the cheaper version in terms of silicon).

    • (Score: 5, Insightful) by Beryllium Sphere (r) on Monday February 20, @11:16PM

      by Beryllium Sphere (r) (5062) on Monday February 20, @11:16PM (#1292792)

      "Most popular" is not a truth-preserving paraphrase of "voted most loved on one site".

    • (Score: 5, Insightful) by looorg on Tuesday February 21, @04:13AM

      by looorg (578) on Tuesday February 21, @04:13AM (#1292818)

      This is hardly the first, or last, news piece about the greatness of Rust. Everybody loves it and it is all everyone writes code with these days. Yet when I ask around with friends, colleagues and such nobody is using it. They keep using the same old things as before. So the "love" doesn't appear to be reciprocated among the masses, or well people I know at least. One would thing one of them was a rust devotee, but no.

  • (Score: 2) by istartedi on Monday February 20, @10:29PM

    by istartedi (123) on Monday February 20, @10:29PM (#1292789) Journal

    The headline seems like it changed one word from a story on the green site [slashdot.org]. Love seems subjective, but can be quantified by polling how users feel about the language. Popularity can be measured too, but it's a distinct thing with different metrics.

    --
    Appended to the end of comments you post. Max: 120 chars.
  • (Score: 2, Funny) by Anonymous Coward on Monday February 20, @10:31PM

    by Anonymous Coward on Monday February 20, @10:31PM (#1292790)

    The best thing about Rust is the community code of conduct.

  • (Score: 5, Funny) by Rosco P. Coltrane on Tuesday February 21, @01:38AM (2 children)

    by Rosco P. Coltrane (4757) on Tuesday February 21, @01:38AM (#1292806)

    I've been working at honing my skills at the next new hot language since I graduated from university but the list keeps growing longer. I'm barely done becoming a Lisp expert, and I'll get cracking on Perl and Visual Basic very soon. Then maybe Ruby - but that so new and so hot I'm not sure it'll ever become a thing...

    • (Score: 3, Interesting) by HiThere on Tuesday February 21, @01:46AM

      by HiThere (866) on Tuesday February 21, @01:46AM (#1292807) Journal

      What about smaltalk and Forth? You don't need to bother with neon, though, as it never transitioned successfully from the Mac System 7. Too bad, it was a really nice object-oriented Forth.

      --
      Javascript is what you use to allow unknown third parties to run software you have no idea about on your computer.
    • (Score: 4, Touché) by istartedi on Tuesday February 21, @02:52AM

      by istartedi (123) on Tuesday February 21, @02:52AM (#1292808) Journal

      His specialized keyboard for APL is arriving any day now.

      --
      Appended to the end of comments you post. Max: 120 chars.
  • (Score: 1, Interesting) by Anonymous Coward on Tuesday February 21, @10:53AM (2 children)

    by Anonymous Coward on Tuesday February 21, @10:53AM (#1292861)

    I can't undestand why they made the let-keyword to normal variable introduction. It makes it heavy looking to have to write that every time, when it is absolutely not needed. Almost as bad as python and the whitespace crap. Someone needs to do some rust repair and patch the "let".

    • (Score: 2) by SomeRandomGeek on Tuesday February 21, @04:44PM (1 child)

      by SomeRandomGeek (856) on Tuesday February 21, @04:44PM (#1292897)

      I can't undestand why they made the let-keyword to normal variable introduction.

      Because in rust "let x = 0;" is a variable declaration while "x=0;" is a variable assignment, and they do different things.
      You can do some weird stuff in rust, like redeclaring a variable:

      let x = 2; // Declares a new variable x, which is an int
      let x = x.to_string();  // Replaces the variable declaration of x with one that is a string

      But it still has strong type checking:

      let x = 2; // Declares a new variable x, which is an int
      x = x.to_string();  // Wrong!  You can't assign a string value to an integer variable!

      But why would you want to redeclare a variable, you ask? Redeclaring x doesn't just declare a new variable. It also ends the lifetime of the old variable. So the compiler can immediately reclaim the space that variable had been taking, rather than waiting until it goes out of scope.
      It actually seems to be a pretty common rust idiom to just have one variable that keeps getting redeclared.

      • (Score: 1, Interesting) by Anonymous Coward on Tuesday February 21, @07:33PM

        by Anonymous Coward on Tuesday February 21, @07:33PM (#1292918)
        But you don't need to use an extra word for declaring a variable. Either specify type e.g INT an_integer = 5; // Regular annotation or in suffix an_integer = 5i32; // Suffix annotation Both ways of these wouldn't need an extra, useless word. The compiler knows that it is not assignment when you declare a type too.
  • (Score: 3, Funny) by bart9h on Tuesday February 21, @04:10PM

    by bart9h (767) on Tuesday February 21, @04:10PM (#1292890)

    "It's enjoyable to write Rust, which is maybe kind of weird to say, but it's just the language is fantastic. It's fun. You feel like a magician, and that never happens in other languages,"

    So, it's the first time you fall in love with a language, huh?

    I can say I feel the same about writing code in Perl.

(1)