Hacker News new | past | comments | ask | show | jobs | submit login

> an assertion that type classes are OO

They never occurred to me as OO. Could someone explain this?




Sure, since I mentioned it.

Sorry if I misassume your OOP experience.

Many think about OOP as introduced by Simula/Smalltalk, or how it is served by Java/C#... ones.

However there are many other ways of doing OOP, which many of us in the old (early 90's) experimented with, while OOP was striving to become mainstream.

Type classes in Haskell and their use, can be easilly mapped to interfaces/protocols/traits/... in the OO world.

From the OOP point of view, type classes are a group of operations that can be applied to a given type and refereed to by a specific name.

Which allows writing polymorphic operations over types that support a specific a specific group of functionality.

Polymorphism and data hiding are the common concepts across all OOP proposals.

As for the remaining concepts, there are lots of languages that agree to disagree, between mainstream, academia and lost OOP battles.

And I can call one of the many Simon Peyton Jones talks that describe this, http://yow.eventer.com/events/1004/talks/1054, starting at 00:42.


To my mind, the biggest thing missing from typeclasses that you get automatically with many OO systems is a sense of persistent identity of objects. Of course Haskell has ways to roll your own, and I'm not sure the decoupling is a bad thing by any means, but it's a difference.


tnx. very insightful. I'm not fully convinced that type classes are OOP, but I certainly understand why --for a very broad definition of OOP-- one might think they are.




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

Search: