| > your argument was that safe Rust is just as powerful as C++, just proved safe statically. This is far from the truth and you refuse to accept the correction. No, it wasn't; sorry if you thought it was. My argument was that the cognitive overhead of satisfying the borrow checker isn't much different from the cognitive overhead in writing safe C++ code. Perhaps I shouldn't have used the word "equivalent", but that was my original point. Then you said "The things you can prove statically with the borrow checker are a subset of the things that wont trigger UB in C++.", and I made the theory/in practice distinction, but at no point did I say that was wrong, I just said it wasn't relevant to my point. Just to be clear, this is the set of things I believe: - Rust lifetimes/borrowchk have little to no additional cognitive overhead as compared to writing safe code in C++ - Rust lets you approach problems without having to worry so much about safety, which lets you play more fast and loose with references (avoiding unnecessary refcounting, etc) I agree with you that: - C++ lets you do more patterns safely than safe Rust lets you compile; and some of these patterns are used often. - Rust needs to work on improving on things like nonlexical borrows. I disagree that the above two are major problems or come up often in practice whilst programming Rust. It could be that we've had different experiences whilst programming Rust, however. > I count 56 imports of Arc and 37 of Rc in servo, would you wager the equivalent parts of chromium or firefox use more ref-counting? Sure. Firefox has two garbage collectors. Not one. Two. (One of them is Spidermonkey's, which is expected, since Javascript is GCd. The other is for the DOM) Firefox also has many different types of FooRefCounted base classes, which seem to be used all over the place. Almost all the Arc is in the highly-parallel layout. Note that "imports Rc" just means that it deals with an Rc'd value, not necessarily introduces a new Rc'd value. (On the other hand in C++ often you use base classes for Rc, which means that the derived class is Rcd everywhere) For example, in all of the Servo DOM code, the Page is Rc'd (I forgot the reason, but we don't thrash the refcount too much there), and JS callbacks are Rcd (because of a sticky interaction with the JS runtime, to be expected of something like that), and nothing else. That itself accounts for 20 imports of Rc, even though it's just two kinds of things being Rcd. Arcs are used in code interfacing with the network or layout stack (I think, I haven't looked closely) > People routinely do safe things in C++ that would be impossible to express in safe Rust code. You need to let go if this untruth. I agree with this. That's not what I'm saying. I'm not refuting the existence of safe things C++ lets you do that Rust doesn't. I'm just saying that Rust lets you feel safer > I don't think Rust programmers use in the real world. Sure, that's not how we program. Because for the vast majority of cases since lifetime annotations exist it's pretty easy (for a Rust programmer) to figure out how to borrow things safely. But there are cases where you're unsure; and it takes very little time to try something out and see what happens. > Any instance of actually resorting to reference counting because of the inability to make the borrow checker happy actually counts against Rust, not for it. I don't see refcounting being used to "make the borrow checker happy"; I see it being used in cases where its necessary. > Some simple things aren't even expressible at all without non-lexical borrows, no matter what gymnastics you try. I disagree, in my experience it's very rare to hit a situation where you need nonlexical borrows. > Some examples include borrowing a RefCell Ah, right. I don't consider refcell too "heavyweight" (and often it can be replaced with the zero-cost Cell), but yes, it does get broken out more than necessary sometimes. I agree with you on that. |