News for hackers. Stuff that matters.
Re:Rust is not a good C replacement by joshdover on Monday March 25, 2019 @10:53AM (#19482927)
Most of the author's points here derive from the fact that C has been around for nearly 50 years and Rust a mere 8. This post should really be titled "Rust is not a good C replacement _right now_".

Yes, Rust still has a long way to go to be the right tool for all the things you can do with C today, but that doesn't make it less. It clearly has benefits when writing concurrent and safe code. You pay for this with a learning curve, but the Rust team has been shaving this curve down through better tooling and documentation for the past few years.

> Yes, Rust is more safe. I don’t really care. In light of all of these problems, I’ll take my segfaults and buffer overflows.

I suspect that for the author's work, these things may not matter much. But to a programmer working on any software where security is paramount (many web infrastructure pieces), this feature is golden.

I expect that as Rust matures, we'll see a solidified spec, competing implementations, and expanded build tooling. C has a long head-start, not to acknowledge that is just wrong.

Re:Rust is not a good C replacement by steveklabnik on Monday March 25, 2019 @10:55AM (#19482948)
8 is even stretching it, May will be four years since things have actually been stable. Even that was the minimum we could provide guarantees for.
Re:Rust is not a good C replacement by z3phyr on Monday March 25, 2019 @11:02AM (#19483045)
Rust is much more complex than C, it is not even in the same sphere of usage. A language like zig could be a decent C replacement.
Re:Rust is not a good C replacement by skybrian on Monday March 25, 2019 @11:08AM (#19483121)
On the other hand, Go has a very readable specification that was written early and is maintained to always be up to date.

Why couldn't the Rust team maintain a spec and keep it up to date by changing it in the same pull request that changes a language feature in the compiler? This seems like mostly a matter of discipline.

Re:Rust is not a good C replacement by steveklabnik on Monday March 25, 2019 @11:18AM (#19483241)
> Why couldn't the Rust team maintain a spec and keep it up to date by changing it in the same pull request that changes a language feature in the compiler? This seems like mostly a matter of discipline.

It's not that, it's that we take the idea of a spec very seriously. We want to have a spec that's extremely solid, and so there's a lot of foundational work that needs to be done first. That work has been ongoing. Not all specs are created equal, and good ones take a lot of time.

For comparison, C was created in 1972, and the first specification happened in 1989.

Re:Rust is not a good C replacement by skybrian on Monday March 25, 2019 @11:36AM (#19483443)
Okay, but this seems like letting the perfect get in the way of the good? A maintained, readable, informal spec should be quite useful as a starting point for writing a more formal spec later.

It need not be definitive. It would be quite reasonable to point out areas that aren't nailed down yet - this is also useful for the reader.

Re:Rust is not a good C replacement by TheCoelacanth on Monday March 25, 2019 @11:52AM (#19483611)
What do you want out of an informal spec that isn't provided by "The Rust Reference"[1]?

[1] https://doc.rust-lang.org/reference/index.html

Re:Rust is not a good C replacement by skybrian on Monday March 25, 2019 @12:22PM (#19483907)
It's useful but I'd like to see a bit more top-level completeness. Every feature should be listed and have at least a cursory description, even if it's not entirely nailed down.

(Maybe it already is like that, but the disclaimers say it's not.)

Re:Rust is not a good C replacement by steveklabnik on Monday March 25, 2019 @01:00PM (#19484265)
The vast, vast majority does, but there may be some missing bits. Printed out, it's about 170 sheets of paper, so there's a lot there.
Re:Rust is not a good C replacement by edflsafoiewq on Monday March 25, 2019 @01:51PM (#19484793)
Borrow checking rules.
Re:Rust is not a good C replacement by cogman10 on Monday March 25, 2019 @05:19PM (#19486837)
I don't know what the current state of affairs is, but this is something they have rightly delayed specing. The original borrow checking rules were quite byzantine compared to what we have today.

I don't know if there is active work going towards making them more relaxed (NLL landed I believe). However, a ton of work has happened to get them out of the way as much as possible.

Re:Rust is not a good C replacement by steveklabnik on Monday March 25, 2019 @11:43AM (#19483524)
That's what the reference is, and it's there for exactly that purpose.
Re:Rust is not a good C replacement by mjw1007 on Monday March 25, 2019 @02:48PM (#19485495)
The Rust team adopted a rule in December 2016 saying that all new language features must be documented in the language reference before landing on the stable release branch:

https://github.com/rust-lang/rfcs/blob/master/text/1636-docu...

As far as I can tell after adopting the rule they didn't proceed to enforce it.

Re:Rust is not a good C replacement by steveklabnik on Monday March 25, 2019 @02:58PM (#19485603)
It's more complex than that. From a development standpoint, doing it this way was a real pain. This is due to the reference being in a different repo than the change itself.

We decided to relax this rule last year, and so instead, issues need to be filed. They then get filled in after. This has its own set of drawbacks.

Re:Rust is not a good C replacement by JoeAltmaier on Monday March 25, 2019 @10:56AM (#19482976)
Its not unreasonable to expect Rust to have looked at history, and improved upon it. To start out less than C means what? We don't want to wait 50 years for another language to 'mature'. Why can't it start out as good as, or even a step ahead of what came before?

That may be the source of the disappointment surrounding deployment of Rust - why is it behind and not ahead of other tools?

Re:Rust is not a good C replacement by Sharlin on Monday March 25, 2019 @11:07AM (#19483104)
That doesn't make any sense. What do you mean "less than C"? Rust definitely looked at history and improved upon it, that's the whole point of the language! The author's gripe was that they feel Rust is evolving quickly much beyond C (like C++), not that it's trying to catch up on C. And do you really expect a language to just appear one day, fully grown, like Venus from a seashell?
Re:Rust is not a good C replacement by joshdover on Monday March 25, 2019 @11:09AM (#19483132)
The author's opinion of Rust being less is that, an opinion. It does have large advantages over C: memory safety, an incredibly powerful type system, a compiler that supports detailed error messages, a powerful build tool (Cargo), an expressive macro system, etc.

Others who have built applications with Rust seem to be coming away with a much different impression that the author. He does mention some gaps (lack of a spec, unstable ABI) but these are not hardstops for all usecases. The main thread of complaints appear to be from lack of choice of tooling and compilers.

I'd wager that the advantages outweigh the drawbacks for many projects, though not all.