[m-rev.] Fast string library
Peter Schachte
schachte at cs.mu.OZ.AU
Wed May 16 10:50:18 AEST 2001
> > The big problem with this kind of string representation is that
> > the builtin comparison operation won't work properly, and we
> > don't yet allow user-defined comparison predicates. This means
> > that using `str's as keys in a map won't do what you want.
> >
> > This module probably isn't really usable until that's fixed.
>
> You're right, of course. Typeclasses seem like the right thing
> for the job... another one for v2.
I don't think type classes are quite right for this, since comparison is
available for all types. I think we need Mercury to support a "where
comparison is" clause on type definitions. Or perhaps this idea should be
generalized to the concept of a user-defined type class that has a default
implementation of all methods. The default definitions can be used to make
every type an honorary member of the type class; an instance declaration
would only be needed where an alternative to the default implementation for
some methods is wanted.
--
Peter Schachte <schachte at cs.mu.OZ.AU> Ultimately, there's no such thing as
http://www.cs.mu.oz.au/~schachte/ "organizational behavior"; it's all
Phone: +61 3 8344 9166 behavior of the people in the
Fax: +61 3 9348 1184 organization. -- Stephen Covey, et
--------------------------------------------------------------------------
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