[mercury-users] maintaining state in instances of typeclasses

Richard A. O'Keefe ok at atlas.otago.ac.nz
Wed May 16 10:56:20 AEST 2001

	1 - SUPER - calling a method in the "superclass" of a type

There is no "THE" superclass.  A typeclass may be derived from several
typeclasses.  There's not equivalent of "super" in Mercury (or Haskell
or Clean) for basically the same reason that the ANSI C++ committee
flatly refused, several times, to add "inherited" to C++:  you can get
the same effect using other means.

	2 - automatic search for a method in an inheritance hierarchy of type

Type classes do form a multiple inheritance hierarchy, and the search
for "methods" is automatic.
	I'm kinda stabbing in the dark with these questions.
	But my goal is to see just how capable Mercury is in dealing
	with object-oriented programming.

The Central Dogma of OOP is
    Object = a thing with Identity, State, and Behaviour.

Mercury (like Haskell and Clean) has *TYPE* classes, not *OBJECT* classes;
it has no objects.  You manipulate values, not mutable things with identities
that persist through state changes.

By _far_ the most effective way to use Mercury is to use it as a declarative
language.  If you want C++, Java, Eiffel, Smalltalk, &c, you know where to
find them.  Mercury has been designed to support an entirely different way
of thinking about programming.
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe

More information about the users mailing list