
"Object" in common parlance is an amalgam of: data structure, methods for that structure, state-boxes, and compositions of this amalgam. All developed over time using the age old method of accretion. It says something when Scott Meyer can make a living writing books about what you shouldn't do in C++. There's also a fellow who's put together an interesting piece of criticism of OO: http://www.geocities.com/tablizer/oopbad.htm. Shawn On Thursday 05 September 2002 12:58 pm, Alastair Reid wrote:
Sill I want to make objects packed with their objects and functions. Doesn't mean that I have to use existential data types?
Only if you need to hide the type of the object.
If you don't need to hide the type then Haskell's typeclasses give you (what I understand of) what you want.
I can write polymorphic functions which take an arbitrary type of object and invoke methods like ==, + and show (say) on it.
foo :: (Eq a, Num a) => a -> String foo x = if x == 0 then "" else show (x+1)
Actually, I suspect this is not quite what you want but the word 'object' has been used by so many people to mean so many things that it's only by throwing out strawmen like Haskell's typeclasses that we can understand what you actually do mean.