[m-rev.] for review: user-defined comparison

Simon Taylor stayl at cs.mu.OZ.AU
Sun Jul 14 03:48:02 AEST 2002


On 14-Jul-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 10-Jul-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > 
> > Allow user-defined comparison functions using the syntax
> > :- type t ---> t where equality is t_equal, comparison is t_compare.
> >
> > Allow user-defined equality and comparison for foreign types using the syntax
> > :- pragma foreign_type(c, t, "c_t") where
> > 		equality is t_equal, comparison is t_compare.
> 
> 
> What?s the rationale for this change?

The lack of user-defined comparison is preventing us from adding
useful library types, for example cords, because they can't be used
as keys of a map. The lack of user-defined equality and comparison
for foreign types will reduce the usefulness of interoperability
with .NET for the same reason.

> This solution is not a complete solution to the problem,
> and it is not extensible.  For example, you still won?t be
> able to serialize foreign types with io__write_binary,
> or to display user-defined types (e.g. bitset) appropriately with io__print.
>
> I think the right thing to do in the long run is to adopt an
> extensible solution, and I don?t think the syntax will look like
> this syntax. 

No argument here.

> Is the problem that you are trying to solve really so
> severe that we need to adopt a temporary kludge that we will eventually end
> up replacing with something different?

Realistically, I don't see us changing map.m to use typeclasses
any time soon.

Simon.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list