2 ms·
I suspect `defer` is the mainstream right tradeoff between the implicit nightmarish semantics of C++ and the formalism of rust. I think the Rust view of C++ wi
by mjburgess 4y ago
I suspect `defer` is the mainstream right tradeoff between the implicit nightmarish semantics of C++ and the formalism of rust.
I think the Rust view of C++ will turn out to be an over-reaction. The issue wasn't a failure to make the implicit explicitly provable, it was simply to make it explicit at all.
- masklinn 4y ago> I suspect `defer` is the mainstream right tradeoff It’s not. It’s a conveniently simple language addition which foists all the issues and edge cases onto the language user. Defer is a limited subset which is more verbose and more error-prone. However like “context managers” (e.g. try blocks, using, with, unwind-protect, bracket) it also works acceptably in languages where ownership concepts are non-existent or non-encoded, whereas destructors / drops require strict object lifetimes. > The issue wasn't a failure to make the implicit explicitly provable, it was simply to make it explicit at all. What, pray tell, would be the use of making borrows “explicit” then ignoring them entirely? Useless busy work?
- mjburgess 4y agoWell i didn't mean only defer, context managers also count as a 'making explicit'. My point is that requiring compile time proofs is likely too far to reach the practical goal. Indeed, it seems most Rust code today agrees: widely turning off the borrow checking with copies and the like.
- jamincan 4y ago> Indeed, it seems most Rust code today agrees: widely turning off the borrow checking with copies and the like. I here this and that `unsafe` is widely used in Rust code bases repeated a lot, but is there any actual data backing this?
- mjburgess 4y agoThere are three "dialects" of rust: borrow-checked, unsafe, and copy-everything. The existence of these three "dialects" goes to my point that the borrow checker isnt The Ideal solution to the problem of high-perf. safe static computing.
- anonymoushn 4y agoSome of this data may be difficult to collect, because some project leads evaluate Rust, discover that the entire ecosystem is built on top of libraries that endlessly thrash a global allocator with synchronization primitives in it, and move on.