On Tue, 5 Oct 1999, George Russell wrote:

> Perhaps I'm being stupid.  (It certainly wouldn't be the first time!)
> But what does OO give me that I can't get with existential types (in
> datatype definitions) and multiparameter type classes? The latter seem
> to me much more powerful, since I can add dancing and singing methods
> to objects without having to go back to the original class definition.

1) Dynamic types.  You can't cast up.  That is you can't recover the
original type from an object in a existential collection.  You need to
use a dynamic type library for that.  And the library proved with hugs
and ghc leaves a lot to be desired.  In an OO langauge all classes
automatically cary dynamic typing information.

2) More specific types, you can't _easilly_ call the more general type.
For example in OO this is very commen:

class Base
  virtual foo()
    do stuff....

class Derived, extends Base
  foo()
    call Base::foo()
    doo stuff

3) Encapsulation.  You can't have private and protected members.  Some
of this can be done using modules.  However it is more work.

4) Cleaner more natural syntax.

---
Kevin Atkinson
[EMAIL PROTECTED]
http://metalab.unc.edu/kevina/




Reply via email to