Hi there! I haven’t made much of a name for myself in the Rust world yet, so I hope it’s appropriate for me to bring up this matter. My experience with Rust so far has been wonderful (I’m using it for osdev), but one thing sticks out to me in particular - how Rust code is built.
The norm with other languages that run on llvm (C and C++ being the obvious ones) is to use headers to describe your API and data structures, and then implement them elsewhere. This has several significant advantages. Among them:
- You can compile a single source file into an unlinked object
- It follows that you can link them all together later and only build modified files (incremental compilation)
- The API is very clearly defined through header files
- Alternate implementations of the same API are easy to build and use as a result
- You don’t have to go reading through the code to learn the API
- You don’t have to have shared libraries installed to compile against them
- Interop with other languages is easy
- C and C++ and Assembly all get along smashingly without any extra work
- Mixed language projects have no additional effort required to maintain
I realize that we may be a bit too entrenched to revisit this, but it concerns me enough to bring it up. With my own project that’s been going against the grain on this issue, I’ve found that it’s entirely feasible to go the header route (or something hacky that resembles it, in my case). There are many benefits to describing your API without forcing the implementation to accompany it, and I can’t think of anything but drawbacks for the opposite position. Can someone shed light on why headers aren’t involved, and if not, is it too late to fix this?