mutable records
Shawn P. Garbett
Shawn@Garbett.org
Thu, 5 Sep 2002 08:40:09 +0000
"Object" in common parlance is an amalgam of: data structure, methods for=
that=20
structure, state-boxes, and compositions of this amalgam. All developed o=
ver=20
time using the age old method of accretion.
It says something when Scott Meyer can make a living writing books about =
what=20
you shouldn't do in C++. There's also a fellow who's put together an=20
interesting piece of criticism of OO:=20
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 objec=
t
> and invoke methods like =3D=3D, + and show (say) on it.
>
> foo :: (Eq a, Num a) =3D> a -> String
> foo x =3D if x =3D=3D 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.