6 ms·
I don't think (2) needs any additional demonstration. Any experienced C programmer who just reads the Rust book should conclude that Rust >> C. (3) can be a p
by cryptonector 7y ago
I don't think (2) needs any additional demonstration. Any experienced C programmer who just reads the Rust book should conclude that Rust >> C.
(3) can be a problem: Rust does not (yet) make it possible to define an ABI for Rust, which means that only by using external representations (C repr) can Rust code interoperate with non-Rust code. However, that's not a very big deal right now.
As to (1), ignoring toolchain stability (which affects C as well), the main concern would be (3) (see above).
Re (4), that's a legitimate question for sure. (My suspicion is that Rust will improve performance in general, mostly due to forcing better (public and internal) API designs on programmers. However, that's just hunch.)
Re (5), benefits. I think mostly it will bring this benefit: cleaner APIs. Obviously that won't apply to Linux's ABI to user-land, since that's not to be broken, but it could benefit the kernel in-tree. Re (5), disadvantages, I think mainly it's the learning curve.
- dmitrygr 7y ago> Any experienced C programmer who just reads the Rust book should conclude that Rust >> C. Mighty nice of you to speak for all of us C programmers, so let me continue the story where you left off: The programer then tries it, gets annoyed with complaints about ownership in cases where the programer clearly did nothing wrong, and goes back to getting work done in C, putting the rust book into his long-overflowing "cute toys to play with later" pile
- pixel_fcker 7y ago“I know this code I’ve just written is safe” is the opening verse for the thousands of security vulnerabilities we see every year.
- dmitrygr 7y agoI know i can implement an up-tree or a doubly-linked-list safely just fine. I do not need to have a straightjacket put on me that prevents me from doing that. If you wish to use it, do. If you want to force your employees to do it, feel free. Telling everyone else how to live their lives and do their jobs is a dick move.
- dmm 7y ago> I know i can implement an up-tree or a doubly-linked-list safely just fine. Great, just make a few unsafe definitions for your list implementation and the rest of your code can enjoy memory safety.
- giovannibajo1 7y agoBut the point is that there is so much provably safe code that the borrow checker doesn’t understand. Let’s not get confused: Rust borrow checker forces you to write in a very narrow space that it can understand, which is a very small subset of safe programs. Sometimes it’s worth it to be so constrained, others simply don’t.
- solarengineer 7y agoI wonder if there could be a mechanism for reporting such cases. " So and So issue detected. If you believe this is not a bug, send this Snippet or A ST as a bug report (If you want, we can do this automatically for you!)" And also "We've detected so and so issue. Please see our wiki <link to specific issue> for an explanation on what may have triggered this, and for ideas on how to rewrite such code"
- dmitrygr 7y ago"doubly linked list detected, this language does not support such constructs without 'unsafe' keyword being used to wrap it"
- ZirconiumX 7y agoWhich is why you implement a doubly linked list using data indices in a Vec<Node>. The resulting data structure is fully safe and resembles an ECS.
- dmitrygr 7y agoAnd features an extra level of indirection for your CPU's dcache prefetch predictor to trip over
- deleted 7y ago[deleted]
- hexane360 7y agohttps://play.rust-lang.org/?gist=c3db81ec94bf231b721ef483f58deb35 https://play.rust-lang.org/?gist=c3db81ec94bf231b721ef483f58...