[m-dev.] Re: for review: big ints

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Apr 7 00:37:25 AEST 1998


On 06-Apr-1998, Bert Thompson <aet at hydra.cs.mu.oz.au> wrote:
> Peter Schachte <pets at cs.mu.OZ.AU> writes:
> 
> |It might also be a good idea to supply functions for operations on mixed ints
> |and big ints.  Otherwise you won't be able to do obvious things like Integer+1
> |and Integer/2 in the obvious way.
> 
> Simple overloading in Mercury won't do this.

Why not?

I think it works OK for mixed operations on complex numbers and
floats -- see the extras/complex_numbers directory.

It is true of course that overloading things this way does interfere
with type inference, and the current type inference algorithm does
not do a good job of resolving such ambiguities.  However, Mercury
requires you do define overloaded functions in different modules,
and one consequence of that is that if you don't import the appropriate
(sub-)module, then you don't get the additional overloaded versions
of the various operations, so type inference works fine.
Thus the user can choose whichever they prefer, type inference
or overloading.

So, I think Peter Schachte's comment is correct -- but I'd be happy for
that to be addressed in some later change rather than as part of this one.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list