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

I will never stop hating on the orphan rule, a perfect summary of what’s behind a lot of rust decisions. Purism and perfectionism at the cost of making a useful language, no better way to torpedo your ecosystem and make adding dependencies really annoying for no reason. Like not even a —dangerously-disable-the-orphan-rule, just no concessions here.


I think there are legitimate criticisms of Rust that fall in this category, but the orphan rule ain’t it.

In most other languages, it is simply not possible to “add” an interface to a class you don’t own. Rust let’s you do that if you own either the type or or the interface. That’s strictly more permissive than the competition.

The reasons those other languages have for not letting you add your interface to foreign types, or extend them with new members, are exactly the same reasons that Rust has the orphan rule.


It's not a restriction born out of purity, notably uncompromising Haskell allows orphan instances.


Good for better, better for us. Rust is choke full of hard compromises and reactionary subcultures. Just recalling ? alone.


[flagged]


> the compiler has no sane answer once both impls are in the graph

but the user could provide an answer.

Julia allows something called "piracy" which is spiritually similar to the orphan rule. and while it is strongly discouraged, the compiler allows it. and when "ambiguities" arise (here called "coherence") it becomes a social problem, not technical, to resolve. and usually package authors are pretty willing to cooperate to resolve it!


Go: error handling stinks. Generics would be dope.

Rust: if you spent 3 weeks understanding the syntax and borrow-checker, here are all of the other problems, and the list keeps growing.

Man this cracks me up.




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

Search: