Haskell or Python!

Andrew Bromage bromage at goaway.cc.monash.edu.au
Thu Feb 3 20:33:30 EST 2000


G'day all.

Jason Stokes <jstok at bluedog.apana.org.au> wrote:

>> Yes.  Haskell is fully object oriented.

neelk at brick.cswv.com (Neel Krishnaswami) writes:

>Is this true? Haskell has overloading, but its type system doesn't
>support subtyping,

Its type class system allows subclassing, which gives you the same thing.
Well, it gives you interface inheritance which, when you think about it,
is all that CORBA and the like gives you too.

>and overloaded methods are chosen at compile time
>rather than based on the runtime type.

Existential types would fix that problem by generating the virtual
method table at compile time for each existentially quantified type.
The benefit is that you would only pay for the vtable it where you
actually use it.  As I mentioned in a previous post, existentially
quantified types are a proposed addition to the language.

>Instead, you use pattern
>matching to replace what subtyping and runtime method selection give
>you in OO languages.

That's one possible implementation, but it doesn't give you separate
compilation, since there is no way to extend an algebraic type with more
alternatives without recompiling.

Cheers,
Andrew Bromage



More information about the Python-list mailing list