[m-dev.] Module qualification of typeclass methods

Peter Ross peter.ross at miscrit.be
Tue Oct 30 03:51:03 AEDT 2001


DJ and I were discussing the merits of the following change.

Currently for the following code

:- module mod.
:- typeclass foo(T) where
[
    bar(T) = int
].


if we wish to use the fully qualified name for the method bar it is

    mod__bar(X)

However we could allow the typeclass declaration to introduce a new
namespace, thus the fully qualified name would become

    mod__foo__bar(X)

This change has the advantage that more than one typeclass at the same
scope can have a method with the same name and for these names to be
distinguishable.  This is useful for doing interoperabilty on the IL
backend.  It makes the mapping between objects and typeclasses much more
natural.

The disadvantages of this change are: it is not backwards compatible and
it no longer allows a typeclass method to easily become a normal
predicate, as any qualified uses of that name will have to be adjusted.

Pete
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list