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

Which UI code specifically are you referring to and why would the borrow checker prevent you from factoring it out?


Well, I think the one that stuck out was here: https://github.com/SixArm/rust-guideposts/blob/main/projects...

But here: https://github.com/gtk-rs/gtk4-rs/blob/master/examples/text_...

and here: https://github.com/gtk-rs/gtk4-rs/blob/master/examples/clock...

The moment some poor slob of a beginner tries to refactor any of those closures into a "normal" function, they're going to get beat over the head by the borrow checker.

Yes, I know why they're required in Rust. And it makes sense once you know Rust well. But a beginner isn't likely to understand why they can't refactor a closure into a function in Rust without a whole lot of clone().

Coding "examples" for Rust need to stop using that closure style--especially in "beginner" code.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: