[m-dev.] Foreign type compare and unification

Ralph Becket rafe at cs.mu.OZ.AU
Tue May 14 15:06:39 AEST 2002


Peter Schachte, Tuesday, 14 May 2002:
> 
> Actually, it's the "etc." in your message that is the most
> interesting.  Are you suggesting that the language designers should
> come up with a list of operations that should be defined by default
> for all types, but users would be permitted to override the default?
> Or are you suggesting that users should be able to define operations
> that could be applied to any type, but still permit other users to
> define specialized versions of those operations for some of their
> types?  The latter would be nicer.  I think this amounts to a special
> kind of type class of which every type (at least every algebraic type)
> is implicitly an instance, provided that all methods have default
> implementations.

If you have dynamic type class casts then you can write generic code
that checks to see whether a given value has a type that is an instance
of a particular type class supplying type specific code.

When/if this happens, it will make the pretty printer a bit simpler, for
starters.

- 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