[Shootout-list] Re: OO (was Re: process creation & message passing)
Aaron Denney
wnoise@ofb.net
Thu, 21 Oct 2004 23:11:03 +0000 (UTC)
On 2004-10-21, Isaac Gouy <igouy2@yahoo.com> wrote:
> Shifting judgement onto the test is just going to make it more
> difficult to write benchmark tests and more difficult to write programs
> that meet them. (Now we have to write a test that will distinguish
> between records/procedures and objects/methods etc).
Simple: the object system used must allow dispatch to be controlled
by the type of the object, and adding new types of objects must not
involve altering the dispatch mechanism or global mapping tables.
>> My goal is that implementations using something like
>> Haskell or Clean typeclasses can be considered "valid"
>> solutions.
>
> "Haskell provides typeclass-based bounded polymorphism as opposed to
> subtyping polymorphism of object-oriented languages such as OCaml and
> Java. It is a contentious question whether Haskell (alone or with extra
> extensions) can support conventional object-oriented programming with
> encapsulation, inheritance, overriding, statically checked subtyping
> and so on."
I too don't consider Haskell typeclasses to quite meet the usual
definition of OO (though it's very close in most implementations, what
with passing dictionaries around to implement the redirection).
The existential types extension, OTOH seems to fit the bill quite well.
> When it stops being contentious, and when this short paper is expanded
> so that you guys can write Haskell programs with subtypes ... we won't
> need to pretend that typeclasses are the same as subtyping.
I don't think subtyping (either explicit or implicit) is the definitive
distinguishing feature of OO -- consider Smalltalk or Objective-C where
all objects can receive all messages (though they may respond with a
"does not understand" exception). In that sense everything is a subtype
of everything else.
--
Aaron Denney
-><-