3 ms·
> Bitfields are hard! They are... Again, like so many others in this thread, you're talking about C's problems. C is not the only language to implement this fe
by ajxs 5y ago
> Bitfields are hard! They are...
Again, like so many others in this thread, you're talking about C's problems. C is not the only language to implement this feature. I keep bringing up Ada because it's a language that features the ability to define structures at the bit level in its core language semantics. It manages to do this in a portable way, with a much more sophisticated, not to mention sound type system.
> But this doesn't mean bitfields can't be done in Rust...
Why should users need to rely on installing third-party additions in order to do something so basic like this? With the addition of third-party frameworks, and tooling you can make C as safe as Rust too, so I don't think the argument that third-party dependencies can solve this problem are relevant. I'm judging these languages simply on how well they allow me to express the semantics required for low-level programming.
> About interoperability with C (and C++), I really like bindgen, cbindgen and cxx. The bindgen book [3] is straighforward...
Ada comes out of the box with this functionality. It doesn't require reading a 'book' to understand it either, it's very straightforward.
> beats any language I know hands down - that is, if you use crates like thiserror and anyhow...
Again, why should someone need to install third-party tooling and dependencies for such basic features? The fact that so many responses list a litany of external dependencies to address Rust's shortcomings does not lend much credibility to Rust's design.