r/cpp • • Oct 24 '24 • Take My Silver 1

Why Safety Profiles Failed

https://www.circle-lang.org/draft-profiles.html
180 Upvotes

347 comments sorted by

View all comments

Show parent comment

1

u/ts826848 Oct 25 '24

Oh, didn't realize it was in the library documentation. Seems like I have some fun to add to my reading list!

So in summary, it sounds like you have something like a reader-writer lock for the threading-related aliasing checks plus the Send/Sync equivalents? And the aforementioned prohibition of lifetime-relevant mutable aliasing handles the other bits of what Rust's mutable XOR aliasing restriction does?

1

u/duneroadrunner Oct 26 '24

Yeah, I kind of over-simplified it, but that's the gist. Multi-threading is one of the "less elegant" parts of the solution, in part due to C++ pointer/references not being naturally amenable to safe asynchronous sharing. And it probably doesn't help that the documentation isn't the greatest at the moment, but there are usage examples for each item. The documentation does kind of assume the reader is familiar with (traditional) C++ multi-threading and mutexes. And if you haven't already read that section, the term "scope pointer", by default, just means "raw pointer". If you have any questions, feel free to post them in the "discussion" section of the github repository, and any other feedback is welcome :)

1

u/ts826848 Oct 26 '24

I'll keep that in mind when I find time to sit down and devote some proper attention to the docs (hopefully sooner rather than later!). Thanks for taking the time to explain!