Hacker News new | ask | show | jobs
by jerf 3901 days ago
"I think it's a net negative for usability because it saves a few keystrokes at the cost of precluding implementing interfaces for types outside of the package they were defined in without writing annoying wrapper structs"

It's a very pragmatic answer. As someone who generally straddles the pragmatic/theoretical divide, I mean that both fully as praise and fully as condemnation. ("Do I contradict myself? Very well, then I contradict myself, I am large, I contain multitudes." - Walt Whitman)

I never did hear what Rust decided to do about what Haskell called the "orphan instances" problem, I only heard about the problem... what happened there? (Honest question, not critical in any way.)

1 comments

Orphan instances are forbidden in Rust. But you can still implement traits for types that weren't defined in your crate as long as your crate defined the trait, which is an extremely important feature that Rust code uses all the time (and is incompatible with structural typing).