P.S. This old blog post is not about Rust-in-Firefox, but it does cover a related topic: How the Servo browser engine (written in Rust) interacts with the Spidermonkey JavaScript engine (written in C++ and embedded in both Gecko and Servo), including garbage-collected JavaScript objects:
https://research.mozilla.org/2014/08/26/javascript-servos-on...
That said, I don't think there are any direct blog posts about it; Firefox's other code just sees Rust as C code, as far as I know. (I don't work on Firefox though so I could be wrong about some details.)
Rust binaries do define a "main", and setting that up is the runtime's job, like C. But you can also make a library that needs no main at all.
So it means the compiled binary ends up in a simple compatible C ABI? thats pretty nice, if thats the case.
But giving the project is using LLVM, even C++ ABI would be achievable without too much effort (i guess).
Adding C++ ABI support is a significant effort.
Ohh, Now i got it. But its pretty good thing to have anyway. C ABI is the lingua franca anyway to communicate to any language, even C++.
> Adding C++ ABI support is a significant effort.
Ok. So if has its own ABI, im sure it would be a pretty hard undertaking to be compatible with C++.
I was guessing if maybe Rust had managed to squeeze and reuse the C++ ABI.. but sure, giving Rust is not that much alike C++ this would probably be a bad decision for small gains.
Thanks for clarifying.
The other way around -- getting Rust to use the C++ abi -- needs compiler changes and also has questionable benefits.
Yes.. Im sure is not worthy it overall.
In fact Rust in general is awesome for going to a wide range of platforms. I've got a project right now that runs on MSVC-x64/x86, Linux-x64, OSX-x64, Android-armv7, Android-x86, Linux-armv7 and Emscripten. Single codebase and interacting with various languages(C#, C++, Java) via the C ABI. Rust even cross-compiles my C source via GCC crate so I can use C libraries and build for any of those targets from my host(win32) machine.
Also, having just spent a few hours fucking around with linker flags in Qt I can't stress enough how awesome Cargo, Crates.io, Rustup and the sane defaults Rust has. It really is an incredible ecosystem.
[1]: http://rust-belt-rust.com/ [2]: http://rust-belt-rust.com/sessions.html
I don't know, but if I recall correctly, nobody has ever reported a memory safety bug to ripgrep, or even the underlying regex engine. I don't really know how many people use ripgrep, but it's not zero.
I don't have a precise reference off-hand, but I believe I read it in "Making Software: What Really Works, and Why We Believe It".
Obviously you'll probably get closer to what the software is intended to do, but it probably won't reduce bug count in the short term. In the long term, you might end up with fewer lines of code overall (which is also correlated with overall bug count).
Is a rewrite considered as bunch of line changes or not? I would say not.
Also, can I assume that by "correlated with" you mean "positively correlated with"?
If so, isn't a rewrite reducing bug count because you'll end up with far fewer "changed" lines?
(And yes, I meant "positively correlated with".)