3 ms·
Google is writing low-level Android code in Rust
- jsnell 6y agoDiscussion of original blog post: https://news.ycombinator.com/item?id=26714478 https://news.ycombinator.com/item?id=26714478
- xt00 6y agoone thing I didn't see discussed in the previous discussion was -- could there be things added to C++ to add the memory safety features in Rust?
- estebank 6y agoThis is a very common question: "Why don't we just add a borrow checker to <lang>?"[1] Having the same level of memory safety that Rust has can be accomplished in one of two ways: garbage collection, with the associated cost, or extra annotations and robust type system. Changing any existing language to do that would diverge enough from the root language that it would no longer be the same language, losing the benefits of using an existing language to begin with, and foregoing the benefits of building a language that accounts for the way it manages memory in its features. I also personally believe that it'll be easier to make Rust easier to use than to make GC languages faster or non-memory safe languages safer. [1]: https://www.reddit.com/r/rust/comments/ijwl0e/the_borrow_checker_for_other_languages/ https://www.reddit.com/r/rust/comments/ijwl0e/the_borrow_che...
- ec109685 6y agoCould that hypothetical language be easier for a codebase to migrate to than a full rust rewrite?
- estebank 6y agoLike with everything, it depends. The part that can block you is your dependencies. You might be willing to add annotations to your entire codebase, but not to code you depend on. A way to get around this is to make the annotation optional, but that then means that you're perpetually torn between to diverging ecosystems. TypeScript is an example of how it can be done, but I would also point at C where there's no such thing as a "String". You can include your own String type that avoids memory unsafety through a well thought out API, even without changing anything in the language itself, but at some point you'll have to interact with an existing library that doesn't know about your String.
- steveklabnik 6y agoFully agree with what Esteban says, but also, the C++ Core Guidelines are an attempt to add some of these sorts of annotations, so it's one of the closest real-world examples of this sort of approach. They're not attempting to solve all of the problems Rust is solving, but every little bit helps, in my opinion. Checked C is another.
- deleted 6y ago[deleted]
- serial_dev 6y agoI'm very excited about Rust finding its way into more and more projects. I started learning a couple of weeks ago: It feels (compared to C++) learnable, simple, it's fast, it's got a familiar package registry. It's good for embedded, web, WASM, some quick scripts, CLIs. My background is mostly JavaScript, Dart, Java, but now I'm excited to try out something lower level, only thing is that I need to find a way to transition into a good Rust project. I am currently working with Flutter and Dart,
- deleted 6y ago[deleted]