[Haskell-cafe] C++ class = neutered (haskell class + haskell existential)

Gabriel Dos Reis gdr at integrable-solutions.net
Sun Aug 20 00:28:11 EDT 2006


Bulat Ziganshin <bulat.ziganshin at gmail.com> writes:

| Hello Thomas,
| 
| Friday, August 18, 2006, 7:57:13 AM, you wrote:
| 
| >> There is a major difference though, in C++ (or java, or sather, or c#,
| >> etc..) the dictionary is always attached to the value, the actual class
| >> data type you pass around. in haskell, the dictionary is passed
| >> separately and the appropriae one is infered by the type system. C++
| >> doesn't infer, it just assumes everything will be carying around its
| >> dictionary with it.
| 
| > C++ programmers deal with this using a number of techniques, mostly
| > involving templates.
| 
| Haskell type classes are closer to templates/generics than to classes
| itself

I believe Haskell type classes are closer to *parameterized abstract
classes* than to classes.



More information about the Haskell-Cafe mailing list