3 ms·
> A real high-level system programming language must be compatible with C. I cannot agree with this. After I learned rust and tried to mix it with C code I bel
by ordu 6y ago
> A real high-level system programming language must be compatible with C.
I cannot agree with this. After I learned rust and tried to mix it with C code I believe that Stroustrup made a mistake by making C++ compatible with C on a syntax level. Strictly defined FFI boundary is a good thing. It liberates. It allow to track precisely what boundary APIs are, it makes boundary APIs the separate documented thing.
> An opposite example to use Rust for an Nginx module is CloudFlare's Quiche, an Nginx extension to support QUIC and HTTP/3 protocols. While it's definitely possible to use Rust for such kind of tasks, the guys, besides the FFI code for C/C++ bindings, still had to write some C code to patch Nginx.
I took a look at the patch, and it is not clear to me, that the patch was needed because rust wouldn't allow to do it the other way. It seems that cloudflare split their code into rust and C for some other reason, because there is a LOT of C code, it doesn't seem to me as a glue code at all. I believe it does more than just glue rust module and nginx. I'm not sure what the reason, but I could guess that the idea was to add possibility to use different implementations of QUIC and HTTP/3 in nginx, not just this particular rust implementation. So they extended nginx for this, and then implemented rust module.
- vips7L 6y agoI like zig's compatibility with C. You can directly import C headers and the compiler will generate headers for your zig code as well.
- xedrac 6y agoI think Zig will make a great C replacement eventually. I pick it over C any day of the week. But I'd prefer Rust over either of them. Zig's management of heap-allocated memory is very similar to C, which makes it less than ideal for large projects.
- gpderetta 6y agoif Stroupstrup hadn't made the mistake, today we wouldn't be talking about c++ in the first place.