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

> The instances of safe code that the borrow checker can't verify as such are not "corner cases" by and large, they're genuinely non-trivial patterns, often with non-obvious drawbacks such as lack of composability/modularity.

Unfortunately, the borrow checker can't handle a basic observer without falling back to patterns that violate encapsulation. The observer pattern is one of the best patterns for composability/modularity, and I find that the borrow-checker-compliant solutions are more complex and don't solve anything but rather move problems somewhere else.

It's cases like these that make me appreciate Rust's wisdom of adding Rc<RefCell<T>>.



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

Search: