4 ms·
"Applying Traits to the Smalltalk Collection Classes", 2003 https://rmod-files.lille.inria.fr/Team/Texts/Papers/Blac03a-OOSPLA03-TraitsHierarchy.pdf https://rm
by pjmlp 2y ago
"Applying Traits to the Smalltalk Collection Classes", 2003
https://rmod-files.lille.inria.fr/Team/Texts/Papers/Blac03a-OOSPLA03-TraitsHierarchy.pdf https://rmod-files.lille.inria.fr/Team/Texts/Papers/Blac03a-...
Traits as CS concept, are part of OOP paradigm.
- jvanderbot 2y agoThere are shades of OOP, and while you're technically correct I think the meaning of my post is clear.
- sshine 2y agoTraits as CS concept, are part of FP paradigm. Reverse Uno!
- pjmlp 2y agoYes, and someone called Simon Peyton Jones happens to have a talk on how Haskell type classes and classical OOP interfaces interrelate.
- sshine 2y agoYes, and someone called Gabriella Gonzales happens to have a blog post on how objects are like comonads: https://www.haskellforall.com/2013/02/you-could-have-invented-comonads.html https://www.haskellforall.com/2013/02/you-could-have-invente... And someone called Samuel the Bloggy Badger happens to have another blog posts on how comonads are really more like neighborhoods: https://gelisam.blogspot.com/2013/07/comonads-are-neighbourhoods-not-objects.html https://gelisam.blogspot.com/2013/07/comonads-are-neighbourh... ...so it might all just be a scam!
- kccqzy 2y agoThe traits concept mentioned in your link looks very different from Rust traits. It describes something more akin to Java interfaces.
- pjmlp 2y agoJava interfaces are based on Objective-C protocols. The only big difference is how implementation is mapped into the trait specification.
- kccqzy 2y agoAnd that's the problem isn't it? Rust traits are based on GHC type classes, not at all from either Java or Objective-C or Smalltalk.
- pjmlp 2y agoThankfully this fellow Simon Peyton Jones has a talk about how they map into OOP paradigm. "Classes, Jim, But Not as We Know Them — Type Classes in Haskell: What, Why, and Whither" https://www.microsoft.com/en-us/research/publication/classes-jim-not-know-2009/ https://www.microsoft.com/en-us/research/publication/classes... "Adventure with Types in Haskell" 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 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.
- kccqzy 2y agoNo. Did you read the contents of the links you shared? The name of the slides in your first link is "Classes, Jim, but not as we know them". And let me quote from the slides in your first link: From slide 40: > So the links to intensional polymorphism are closer than the links to OOP. From the first bullet of slide 43: > No problem with multiple constraints > f :: (Num a, Show a) => a -> ... From the second bullet: > Existing types can retroactively be made instances of new type classes (e.g. introduce new Wibble class, make existing types an instance of it): > class Wibble a where > wib :: a -> Bool > instance Wibble Int where > wib n = n+1 From slide 46: > In Haskell you must anticipate the need to act on arguments of various type > f :: Tree -> Int > vs > f’ :: Treelike a => a -> Int > (in OO you can retroactively sub-class Tree) From slide 50: > In Java (ish): > inc :: Numable -> Numable > from any sub-type of Numable to any super-type of Numable > In Haskell: > inc :: Num a => a -> a > Result has precisely same type as argument I appreciate you sharing informative links even though they prove you wrong. I haven't seen this set of slides before but I find it a very good concise explanation of why Haskell classes are not traditional OOP classes or interfaces.
- rmgk 2y agoTraits in Rust are more a variant of Haskell typeclasses than of Smalltalk traits. The whole FP vs OOP distinction does make little sense these days, as it has mostly been shown that each concept from the one can neatly fit within the other and vice versa.