3 ms·
> There are important language features missing from C (and C++) that make it impossible to implement a Rust-style mutex API with the same guarantees I've done
by verdagon 5y ago
> There are important language features missing from C (and C++) that make it impossible to implement a Rust-style mutex API with the same guarantees
I've done some experimenting here, and I think it is possible to add a borrow checker to a C or C++ -like language, like the author hints. It couldn't be like Rust's borrow checker, it would just need to be a borrow checker that operates on a "per region" basis, where everything inside the mutex is one region and everything outside is another.
I wrote a little bit about this idea for the Vale language in [0] and then realized shortly afterward that the idea can be used to add fearless concurrency to any existing language.
[0]: https://verdagon.dev/blog/seamless-fearless-structured-concurrency https://verdagon.dev/blog/seamless-fearless-structured-concu...
- hermanradtke 5y agoIt is definitely possible. What is not possible is convincing all your co-workers to use it or updating all the libraries you depend on to use it. Thus, the value prop becomes quite low.
- verdagon 5y agoPerhaps, but maybe there's a better approach. I prefer having a new language which can build on and speak to other languages in their own paradigms. That's what Swift did for Obj-C and also the direction we're going with Vale's region borrow checker.
- hermanradtke 5y agoC is the lingua franca of systems languages. Rust, nim and zig all seem very capable of wrapping C libraries while providing more safety.
- pjmlp 5y agoThat is why SecDevOps team turns on the static analysis on the CI/CD server, with the decision backed by the security guidelines. Then they can suck it up or move elsewhere.