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

My understanding is that "ad-hoc" in this context means that you are not defining a single generic implementation but adding individual impls for specific types. There's no fundamental difference between Java's overloading and Rust's implicitly inferred trait implementations in my opinion.

Rust's implementation is more orthogonal, so specifying which impl you want explicitly does not require special syntax. It's also based on traits so you'd have to use a non-idiomatic style if you wanted to use overloading as pervasively as in Java. But are those really such big differences? See my reply to the original where I post an example using Rust nightly that is very close to overloading in other languages.



They were referencing the title of a specific paper, which invented type classes: https://dl.acm.org/doi/10.1145/75277.75283


Thank you, I did not know this paper and totally missed the reference.




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

Search: