[m-dev.] Foreign type compare and unification

Ralph Becket rafe at cs.mu.OZ.AU
Tue May 21 12:41:28 AEST 2002

Peter Schachte, Tuesday, 21 May 2002:
> FWIW, I think simplicity and generality, in that order, are the key
> attributes of elegance.  If a simple scheme will allow users to define
> their own classes to which all types belong, but which allow default
> methods to be overridden, I think that would be more elegant than a
> fixed list.

I was talking about this yesterday with Mark.  One idea was that we
allow declarations of the form

	:- default_instance c(T) where [...].

which would essentially make all types T an instance of type class c/1,
and provide default method implementations (an explicit c(T') instance
declaration for T' overriding the default_instance declaration for T.)

Mark objected that this would be bad in that the behaviour of a program
could change if someone later added an explicit c(T') instance
declaration.  However, this will happen anyway if we get the hoped-for
dynamic type class casts and use them in generic predicates (e.g.
to_doc/[1,2] in pprint.)

- Ralph
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