Live data from Hacker News

Why Rust for Low-Level Linux Programming?

groveronline.com

71–80 of 231 posts

Re: Why Rust for Low-Level Linux Programming?

#71

Earlier quoted context omitted.

I will certainly concede the second, but we put a _lot_ of effort into ensuring that Rust is stable. Things have changed a lot since the pre-1.0 days.

> Things have changed a lot since the pre-1.0 days. The instability of the pre-1.0 days left a very bad impression on many people who tried Rust then. They came to know Rust as a compile-today-but-not-tomorrow kind of language. What, if anything, is being done to try to inform these people that the situation has changed, to encourage them to try Rust again? What's being done to restore Rust's reputation?

If anything we have better stability guarantees, we actually run the beta against the entire ecosystem before releasing.

Rust has been _extremely_ vocal about its stability guarantees. Not sure what else can be done here.

Re: Why Rust for Low-Level Linux Programming?

#72
post #47

Earlier quoted context omitted.

Or it is faster than C ( http://benchmarksgame.alioth.debian.org/u64q/performance.php... ). Depends which link you click on.

From the looks of it, that Rust program spawns 20 threads and does the computations in parallel. The C program does it all in one thread and doesn't even utilize sse intrinsics. I know full well that The Computer Language Benchmarks Game isn't a perfect source for programming language speed arguments, but what you can you do.

> but what you can you do.

Not make sweeping generalizations based on one benchmark you didn't write?

Re: Why Rust for Low-Level Linux Programming?

#73
post #68

Earlier quoted context omitted.

> The only reason you would is ease of updating dependencies Or if Rust doesn't support your OS yet. I am working on porting LLVM and writing a MIR to C++ translator in parallel. We'll see which one I get further on. Because I'd love nothing more than to use Rust.

Is the problem the OS, or the architecture/ABI? I wouldn't expect porting to a new OS to be terribly difficult, though it is a time sink since there's a fair bit of API surface to cover to get Rust's libstd ported, and you'd want to work with upstream so they know your platform matters. If your OS doesn't look at all like UNIX, then you'll have to give up on libstd (which talks about "file"s and "processes" and such…

Windows isn't like UNIX, yet still supports libstd fully. That said, yes, if your OS is so different that it doesn't support files or processes or something, you'd have to stick with libcore. The standard library not so much UNIX-centric as it is "common OS features"-centric. We even went so far as to not pick the UNIX names for common functionality, which can often happen with languages that start on a UNIX and move out.

Re: Why Rust for Low-Level Linux Programming?

#74
post #4

As a long-time developer marketing person, I must say Rust is kicking ass, not just as a language but as a community. They are deeply strategic. 1. Clear audience target: They aren't going after C++ gurus or C magicians but people who are new to systems programming. From Klabnik to Katz to literally everyone in the community, they are consistent with this messaging. 2. As part of 1, they have invested a lot in teachi…

> They aren't going after C++ gurus or C magicians but people who are new to systems programming. If this actually is their strategy, is it being done voluntarily or out of necessity? I ask, because I've witnessed enough scepticism about Rust from C and C++ programmers. Rightly or wrongly, there are enough of them who don't appear to be receptive to Rust, and likely never will be. So the Rust community may never be a…

> I ask, because I've witnessed enough scepticism about Rust from C and C++ programmers.

I don't think there's a single language on the planet that hasn't had skeptics, especially at the beginning. Remember how skeptical everyone was of Python at first due to its significant whitespace?

Programmers are very tribal about their tools.

Re: Why Rust for Low-Level Linux Programming?

#75
post #57
post #9

Earlier quoted context omitted.

Designing memory-safe programs in C requires a programmer to reason about the same domains as doing so in Rust, but C doesn't double-check you to make sure you get everything right. With no guard rails, C is a lot more stressful. Re: reducing mental state for a programmer, algebraic datatypes in general decrease the size of the state space of your program by making many illegal states unrepresentable. Without advance…

Why are we throwing away all the work done on static & dynamic analysis tools for C programs in this kind of discussions? Programmers are crippled just for picking C? Come on..

Because ultimatelty they're imperfect.

Sure, C+static analysis is good enough for many situations. But it can't compare with the guaranteed safety offered by Rust.

Re: Why Rust for Low-Level Linux Programming?

#76

Is there any reason why embedded software for autonomous vehicles is still being written in C/C++? This last week I was talking to a friend at a company that makes a small autonomous vehicle. During testing their prototype suddenly went off in a straight line. They had to pull a safety to halt the vehicle or it would have gone straight forever into the Pacific Ocean. Turns out there was an unsafe access to a variable…

A bunch, including: 1. Most of those platforms don't have compilers for any languages other than C(++). If the platform has a lot of history behind it, maybe you could write it in Ada, but that's pretty much it. 2. Development tools (debuggers, static analyzers, standards compliance verification tools and so on) for C and C++ are very hard to match, both in strength and in sheer availability. In the meantime, Rust st…

> A lot of Rust's features simply aren't needed when writing this kind of software (e.g. the breadth of features related to memory management is largely unneeded because everything is statically allocated).

True, but I don't think that Rust's other features wouldn't be useful here. References which know about mutability/immutability, sum/enum types, "fat" pointers/slices w/ bounds checking, the ability to construct library APIs which enforce non-memory safety through session/affine/linear types, sane integer typing, etc, could all still be useful to a fully-statically-allocated program.

Re: Why Rust for Low-Level Linux Programming?

#77
post #29

Earlier quoted context omitted.

A rust -> C compiler would be really nice for those custom/slow updating environments, but I can understand if that just too much of a distraction.

Since I got two replies with basically the same thing at the same time, I'll pick one at random and it'll serve as a reply to both. You won the coin flip :) This is feasible in a sense, but C is a fairly tricky target to compile to: you have to make sure that you don't accidentally include UB in the code you generate. I know pcwalton has lots of feels here... The easiest way to do it would be if LLVM had a C backend;…

> I know that it did, but it was removed a few years back, and I haven't heard anything about it coming back into tree yet.

(out-of-tree) fork(s) have been kept alive by several groups. The most current one I'm aware of is: https://github.com/JuliaComputing/llvm-cbe

Re: Why Rust for Low-Level Linux Programming?

#78
post #35

Earlier quoted context omitted.

Rust is not stable. The language is not battle tested like C/C++.

Yes, Rust is younger. There is less code out there running to root out undefined behavior. Except Rust allows for less undefined behavior. I wouldn't be surprised if it improved at a faster rate then C. Or C++ ( ) ( ) Please don't say C/C++. They are different beasts.

Addendum to your nitpick: Also don't even leave it at just "C++" unless you really are a master of everything in C++98 plus all the new stuff in C++14.

Re: Why Rust for Low-Level Linux Programming?

#79
post #15

Earlier quoted context omitted.

Developer marketing: marketing to developers. Marketing gets a bad reputation among developers, but it's vital for any technology to be marketed: keeping documentation up to date, answering questions for newcomers, explaining strengths/weaknesses, etc. >Don't they have anything to gain from using Rust? Who's "they"?

The magicians.

They might have something to gain, but they're probably deeply invested in the tech already.

People are very hard to dislodge from such positions, unless the new positions have overwhelming benefits such as: a new environment does not support the old tools/programming language; a radical paradigm shift has happened that risks to make completely obsolete their previous knowledge, etc.

Rust is more of an incremental improvement over C++, than a radical leap forward. So C++ magicians are less likely to want to switch over.

Re: Why Rust for Low-Level Linux Programming?

#80

Is there any reason why embedded software for autonomous vehicles is still being written in C/C++? This last week I was talking to a friend at a company that makes a small autonomous vehicle. During testing their prototype suddenly went off in a straight line. They had to pull a safety to halt the vehicle or it would have gone straight forever into the Pacific Ocean. Turns out there was an unsafe access to a variable…

No, there's no reason, as it could have been written in Ada and gotten many of the same safety guarantees as Rust provides.
Post reply on HN