Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Rust is not that bad at prototyping, you need to use the right featureset when writing quick prototype code. Don't use lifetimes, use clone() and Rc/Arc freely to get around borrow-checker issues. Use .unwrap() or .expect("etc.") whenever you're not sure how to pass an error back to the caller. Experiment with the "Any" trait for dynamic typing and downcasts, etc. The final code will still be very high-performance for prototype code, and you can use the added boilerplate to guide a refactoring into a "proper" implementation once the design stabilizes.


Thanks for the advice. That makes sense I guess.

In fact, most of the time, I would favor styles like this even for not prototyping.

At the end, refactoring is also something natural. I would reserve lifetimes for the very obvious cases wirh controlled propagation or for performance-sensitve spots.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: