7 ms·
Have you tried wrapping everything in an Rc<> (or Arc<Mutex<>>) and keeping everything synchronous and single threaded? I've seen people report good success wi
by hedora 4y ago
Have you tried wrapping everything in an Rc<> (or Arc<Mutex<>>) and keeping everything synchronous and single threaded? I've seen people report good success with that for low-performance stuff.
Reference counted languages provide 99% of the benefit of full GCs for simple programs, and I think those two suggestions are enough to mindlessly appease the borrow checker in most circumstances.
- perrygeo 4y agoThis is my approach to "higher level rust" - When the borrow-checker and lifetimes start getting too complicated, there's usually an easier but less-optimal fallback. (RC/ARC + mutexes, clones, Strings, Box dyn) Rust can be a simple(r) language if you're willing to set aside the idea that you need to write performance-critical systems code from day one - just use the basics and optimize if/when needed.
- antifa 4y agoI wish somebody would make a language that looked like ruby/python but all it did was transpile the source file into a rust file with any necessary Rc<>/Arc<Mutex<>> stuff and then run the normal rust compiler. If you wanted to optimize a file, then just run the "eject" command on a file and then replace the extraneous Rc<>/Arc<Mutex<>> stuff with smart people borrow checker stuff yourself. I like crystal and nim, but it would be better to have such a language deeply just actually be rust under the hood and use rust libs natively and use crate literally instead of creating a whole new ecosystem.