For the hundredth time: There is no way to add sound, complete borrow checking to C++ while retaining any semblance of compatibility with existing code.
-
-
Replying to @pcwalton
It would be really useful to be able to cite somebody's write up here. At the moment I am using the argument "even if you think you could do this using RAII, what about NLL?"
1 reply 0 retweets 1 like -
Seconded - please (someone) provide the blog-post-length version of this rant. I keep hearing people argue that there will one day be memory safe C++ with clever annotations.
1 reply 0 retweets 0 likes -
Replying to @ciphergoth @adehohum
It’s a simple argument. 1. Arc<T> is immutable in Rust. Borrow check depends on this restriction. 2. shared_ptr<T> is not immutable in C++. 3. Lots of C++ code uses shared_ptr<nonconst T>. 4. So it is impossible to implement borrow check and preserve compatibility.
1 reply 0 retweets 10 likes -
By no means is the argument limited to shared_ptr. There are dozens of common C++ patterns I could point to that break under a borrow check. Could you, in theory, create some super-limited borrow checkable subset of C++? Sure.
1 reply 0 retweets 7 likes
But it’d be incompatible with virtually all existing C++. Really it would be a different language starting from scratch with zero ecosystem. You’d be better off using Rust, which has an ecosystem.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.