4 ms·
The implementation of traits described in that paper is totally different from the implementation of traits in Rust. Rust has adopted an ontology and syntax fam
by tatterdemalion 10y ago
The implementation of traits described in that paper is totally different from the implementation of traits in Rust. Rust has adopted an ontology and syntax familiar to programmers in object oriented programming to make accessible a form of polymorphism which is quite different.
In fact, the same concept exists in Haskell, where it is called "type classes." (In this case, I think the adoption of OO terminology is harmful to comprehension, rather than helpful). Are we to believe that Haskell is object-oriented also? Is there a language with polymorphic abstraction that is not object-oriented in your formulation?
- pjmlp 10y agoYes Haskell type classes are interfaces from OOP point of view. And given time on the weekend I might try to find out the talk given by SPJ about this very issue. Polymorphism and dynamic dispatch are part of OOP. EDIT: Found Simon's talk Adventure with Types in Haskell, part 1 and part 2: https://www.youtube.com/watch?v=6COvD8oynmI https://www.youtube.com/watch?v=6COvD8oynmI https://www.youtube.com/watch?v=brE_dyedGm0 https://www.youtube.com/watch?v=brE_dyedGm0 At 1:01:01 on the first lecture he discusses how Haskell relates to OOP in regards of subtyping and generic polymorphism and how although different on the surface they share those CS concepts in their own ways. https://www.youtube.com/watch?v=6COvD8oynmI&feature=youtu.be&t=3661 https://www.youtube.com/watch?v=6COvD8oynmI&feature=youtu.be...
- tatterdemalion 10y agoI've seen SPJ's talk. You might notice that in the moment you site, he says that OO and parametric polymorphism are both polymorphism systems. Rust and Haskell are both parametric systems, not OO systems, in SPJ's formulation (and mine). The slide is literally a venn diagram of the two concepts and the abstractions they can encode. What is an example of a language with polymorphism you do not consider to be object oriented? I'm not really interested in being linked to media I've already seen, I'm trying to suss out what you think object oriented means. As far as I can tell, it means "polymorphism," and well - yes I think polymorphism is a great idea, but I don't think its what most people mean when they say "object-oriented." (Also, if Haskell type classes are interfaces, then so are Rust traits. They have the same semantics. But you've already said that Rust traits are traits.)