[mercury-users] overloading predicates/functions

Michael Day mikeday at corplink.com.au
Sun Oct 3 17:15:53 AEST 1999


> 	- use multiple names with suffixes
> 	  (e.g. io__write_string, io__write_float in library/io.m)

Even if you use type classes it seems you will likely end up doing this
anyway, as you have to write the functions to actually implement the type
classes.

> 	- use ad-hoc overloading, and put overloaded versions
> 	  that would have the same module, name, and arity
> 	  into sub-modules
> 	  (e.g. see extras/complex_numbers)

Or if you have type class instances in different modules, you're okay...

> 	- use type classes

This is the method I have adopted. Guess I can't complain about not having
such overloading, although it did surprise me at first.

Thanks,

Michael

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



More information about the users mailing list