OOP vs type classes Re[2]: [Haskell-cafe] type gurus,
can you please help?
Gabriel Dos Reis
gdr at integrable-solutions.net
Wed Aug 16 08:29:27 EDT 2006
Bulat Ziganshin <bulat.ziganshin at gmail.com> writes:
| Hello Gabriel,
|
| Tuesday, August 15, 2006, 10:36:28 PM, you wrote:
|
| > | Moreover, Haskell type classes supports inheritance. Run-time
| > | polymorphism together with inheritance are often seen as OOP
| > | distinctive points, so during long time i considered type classes as a
| > | form of OOP implementation. but that's wrong! Haskell type classes
| > | build on different basis, so they are like C++ templates with added
| > | inheritance and run-time polymorphism! And this means that usage of
| > | type classes is different from using classes, with its own strong and
| > | weak points.
|
| > Roughly Haskell type classes correspond to parameterized abstract
| > classes in C++ (i.e. class templates with virtual functions
| > representing the operations). Instance declarations correspond to
| > derivation and implementations of those parameterized classes.
|
| i can't agree.
You're welcome :-)
| the differences between TC inheritance/polymorphism and
| C++ classes are substantial. i listed them in next part of tutorial which
| you should see alongside this message.
sorry, I did not see that tutorial.
| you can also see paper at
| http://homepages.cwi.nl/~ralf/gpce06/ which is all about consequences
| of differences between classes and type classes for software
| development
Thanks for the reference. Nothing in that paper explores what I
suggested. I don't see how it contradicts what I said.
More information about the Haskell-Cafe
mailing list