logoalt Hacker News

throwaway17_17yesterday at 12:59 AM1 replyview on HN

I just wanted to drop a quick comment to clear up your first question. The term ad-hoc polymorphism to describe both Haskell and Rust’s typeclasses/traits is taken directly from Wadler and Blott’s paper which introduces the idea/concepts of type classes to Haskell. The name of that paper is ‘How to make Ad-Hoc Polymorphism less Ad-hoc’. This paper laid the groundwork for the implementation Rust uses and it is a mechanism for restraining ad-hoc polymorphism. But I think the term still applies to both Haskell and Rust’s typeclasses. Ad-hoc polymorphism is not a derisive term (when used as a term of art in discussions of implementations of programming languages), it is merely the PLT way of saying function name overloading. Rust and Haskell use very similar system to impose restrictions and semantic guiderails on ad-hoc polymorphism, but both languages still have it. To sum, I certainly do not mean any negative connotation with the term, I feel I am using it appropriately and as intended in this domain of discourse.

PS. I intend to write a more substantive reply to your comment, but didn’t think I should leave this unsaid.


Replies

JoshTriplettyesterday at 11:53 PM

I didn't take it as having a negative connotation; I just didn't interpret it in the manner referenced in that paper, and instead interpreted it as being not based on traits/concepts. Even given that, I didn't take it as negative; some people prefer the C++-style model, just as some people prefer dynamic typing.