3 ms·
> designed for embedding Yet implemented in Rust. Why? If you want adoption, the best way to design something "for embedding" is to write it in C.
by general_ai 10y ago
> designed for embedding
Yet implemented in Rust. Why? If you want adoption, the best way to design something "for embedding" is to write it in C.
- ianlevesque 10y agoRust embeds almost as well as C.
- general_ai 10y agoBe that as it may, it's a relatively obscure and quickly changing language, that _ends up calling into C_ anyway.
- steveklabnik 10y agoRust doesn't change in a backwards incompatible way. > that _ends up calling into C_ anyway. What specifically do you mean here?
- general_ai 10y agoSays there it uses sqlite.
- holygoat 10y agoCorrect. That has no bearing at all on whether it's smart to write the rest of the library in Rust. Most non-trivial applications will at some point call out into code written in C, or compiled from some other language. So what?
- steveklabnik 10y agoAh I thought you meant Rust generally, not this project. Makes sense! (I still don't think that's enough to justify using C over Rust here, just that I understand you now.)
- jdub 10y agoDatapoint: GNOME's Federico Mena Quintero is working on a file-by-file port of librsvg to Rust. Compiled Rust objects are linked with compiled C objects. Both Rust and C call functions in librsvg's C dependencies, such as Cairo. None of this is weird; it's precisely what Rust was designed for.
- holygoat 10y agoIt's designed to meet our embedding needs: in Firefox for desktops, Firefox for Android, Firefox for iOS, and Project Tofino (Node + Electron). Widespread adoption a la SQLite is not one of our goals. Rust meets our goals just fine… and it also produces demonstrably more correct software than C, which is important to us. (Not to mention leveraging the borrow checker and data race avoidance to provide safe near-automatic parallelization, which is a neat trick that's not in C's quiver.) I would rather build Mentat in Swift or JavaScript than in C.
- biokoda 10y agoBecause a Rust library is safer, equally efficient, faster to develop, easier to build and can expose a C interface.