3 ms·
The difference is that you don't need compiler for this language. There are many hardware platforms that only come with C compiler.
by fiedzia 10y ago
The difference is that you don't need compiler for this language. There are many hardware platforms that only come with C compiler.
- tyingq 10y agoFor something like curl, where the library is as popular as the command line tool, preserving the C ABI compatibility is probably the strongest reason.
- simias 10y agoRust could expose a C ABI while keeping safe internals. The interface itself would be unsafe of course. There are a few things that rust doesn't handle natively (like varargs functions IIRC) but other than that you could probably write a Rurl that would be completely backward compatible with Curl.
- tyingq 10y agoYes...the post above me was talking about Ocaml. Similar arguments for not redoing curl in Go.
- steveklabnik 10y agoTo be clear, Rust itself does not have varargs, but can handle them with the C ABI.
- Manishearth 10y agoWell, we can call into vararg functions, but not define them. Since vararg functions have the same ABI as the function with only one of the vararg one idea I've always had is to write a macro that lets you write a one-arg function and have it desugar via asm hax.
- wtetzner 10y agoYou do still need a compiler for the language. It's just that the target language is C, instead of assembly.