9 ms·
> Does it though? I think "the industry" has pretty much come around on C being unsafe, and generally not a great choice of language for new projects. If you l
by returningfory2 4y ago
> Does it though? I think "the industry" has pretty much come around on C being unsafe, and generally not a great choice of language for new projects.
If you look at some of the Rust threads on HN right now [0], you find many commenters claiming that there is no reason to replace C with Rust. It could be a vocal minority, but there's still a sense that "not everyone is on board".
[0] https://news.ycombinator.com/item?id=34788714 https://news.ycombinator.com/item?id=34788714
- woodruffw 4y agoHN samples the C (and Rust) communities, but I don't think we should take HN's opinions as representative of either.
- selfmodruntime 4y agoThis. My indicator on the success of a technology has been the volume of disagreement among the HN crowd. Just look at React / Javascript frameworks. HN will hate on those with a fiery passion, while literal trillions of dollars are generated with them.
- randomdata 4y ago> there is no reason for replace C with Rust. If you have some reason to choose C today, I'm not sure Rust is a contender to stand in as a replacement. They are vastly different languages. That doesn't mean there is rejection that C's memory model is unsafe, just that there isn't a "better C" recognized to choose from.
- quectophoton 4y agoIMHO Rust could be a good replacement for C when (if) it gets an actual spec, or at least when (if) there are multiple real implementations of the compiler (meaning, with borrow checker, compiler errors, and all). Because otherwise, you could write Rust 2018 edition (for example), and there's nothing preventing a situation where your currently-valid Rust-2018-edition program stops compiling (or behaves differently) on a future version of rustc even when compiling to that specific edition, just because some behavior is (in the future) considered a compiler bug or something. And it would be perfectly valid to cause such breakage, because there's no definition of "what is Rust", other than "what this specific compiler in this specific version accepts". I'm not talking about whether such possible backwards-incompatible change on a Rust edition would be good or bad. Just that with the current monoculture around a single implementation, there's not many guarantees. A specification, or multiple implementations, would at least add some (good) friction. I'm not denying its current value as a safe language; just that, as it is now, I don't consider it as a good choice for programs that must stay alive for decades, like `curl` or an operating system.
- dralley 4y ago>just because some behavior is (in the future) considered a compiler bug or something Unsound behavior is considered a compiler bug, and is liable to change if you accidentally rely on it. I would hope that having multiple compilers won't change that. The motivation to actually fix soundness holes is one of the primary differentiators of Rust. That said, these are very rare.
- quectophoton 4y agoI would even expect that having multiple implementations would help catch small things that might have been missed in the reference implementation. I'm looking forward to Ferrocene's specification and the gccrs implementation.
- com2kid 4y agoRust is not a C replacement, it is a C++ replacement. Many of the people writing code in C do not want to use C++. And many of the embedded use cases for C already involve very careful memory usage. If you've banned malloc and don't have threads, you've removed a huge swath of common bug sources right off the bat. For someone writing code to setup registers on a DMA controller, Rust has nearly 0 benefit. (That said, no one should be writing new command line utilities in C, parsing arbitrary data in C is dangerous!)
- steveklabnik 4y agoNot everyone agrees with this characterization, including some well known (now former) C developers: http://dtrace.org/blogs/bmc/2018/09/18/falling-in-love-with-rust/ http://dtrace.org/blogs/bmc/2018/09/18/falling-in-love-with-...
- com2kid 4y agoExcellent post, thanks for linking. The arguments made for replacing C with Rust seem sound.
- 4y ago
- marcosdumay 4y agoOh, if you take a large overall sample of the Reddit, you will find the overall opinion that Rust is gay (really, it's way more irritating than here). Those are just people annoyed that their knowledge is getting outdated, and grasping for any medium-approved excuse to not learn the new thing. Those believe that Rust will replace C, they just don't like it. (Anyway, C, like COBOL, won't just die. There's no reason to be afraid.)
- bigbillheck 4y ago> Oh, if you take a large overall sample of the Reddit, you will find the overall opinion that Rust is gay Yeah but do they like the language tho.
- arp242 4y ago> you find many commenters claiming that there is no reason to replace C with Rust I actually don't see many claim that in that thread. There are 196 comments and I didn't read all of them, but only one greyed-out top-level comment says so, and what I can skim from the other comments I don't really see a whole lot of people say "C is fine!" There are some concerns about performance, and some other comments about (alleged) "Rust spam", but that's not the same as "C is fine!" In my experience "C is unsafe" was already generally agreed on about 20 years ago, which is one reason many choose Java, Python, PHP, etc. at the time. It wasn't a universal consensus, but if you were to take a poll in 2003 I bet it would be well over 50%.