4 ms·
Honestly, if you remove the borrow checker from Rust, it’s radically not Rust any more. I hold that the defining feature of Rust is its ownership model; and the
by chrismorgan 5y ago
Honestly, if you remove the borrow checker from Rust, it’s radically not Rust any more. I hold that the defining feature of Rust is its ownership model; and there’s nothing left of that without the borrow checker. (You could assign similar semantics and just not check them, but without the ability to check them they’re completely useless.) Most of Rust’s design hinges upon the ownership model, and most features that it has are there at least in significant part to make the ownership model work or be tolerable. To be sure, you could create a dynamic/scripting language with algebraic data types (enum) and a struct/impl divide; even traits are possible, though mix generics in and it’ll be decidedly bothersome to achieve any sort of speed, yet you kinda need generics for traits to make sense over classical OOP (there’s a reason scripting languages tend to go for classes and such—Rust-style traits work excellently compiled, but not so well dynamic). But you’re talking about converting such code into Rust, and I say: without ownership modelling and the borrow checker you have absolutely no chance of converting it to anything but completely unsafe Rust code (as in: Rust will slow you down and gain you nothing, you should generate something like C instead). And you can’t just sling GC at it: Rust is really quite poorly equipped for that style of box-everything GC code, and the only ways of making it work at all will perform very badly.
- antifa 5y agoThe goal is to abstract away the borrow checker for the business logic of software I write, not for the borrow checker to be absent from a rust compiler. I still want everything that is rust, I just want an alternative to php/ruby/python that is natively integrated into rust and the full rust ecosystem.
- mlindner 5y agoI think this and the original post misunderstands what the borrow checker fundamentally is. The only way to "abstract the borrow checker" is to write another language on top of Rust.
- chrismorgan 5y agoThe borrow checker is pervasive. You can’t just abstract it away. There’s a reason it’s explicit. If you think it’s possible, try designing what it would look like, and what it would compile your code to. You will quickly find that it can’t work without losing the quintessence of Rust completely (and a lot of performance).