[m-rev.] Added int:'/'/2 and builtin false/0

Ralph Becket rafe at cs.mu.OZ.AU
Fri May 17 16:52:28 AEST 2002


Fergus Henderson, Friday, 17 May 2002:
> 
> The change to add false/0 is fine.
> But I don't think we should add '/'/2, unless it is real
> division, i.e. unless it has type `:- func int / int = float'
> or `:- func int / int = rational'.
> In mathematics, '/' is division, not truncating integer division.
> Truncating integer division is really a rather different operation
> than real division, and so I think it makes sense to use a different
> operator for that.

On the other hand, programmers understand that integer division is not
true division; I would argue that it would be better to have special
names for the less commonly used forms.

> But I think the reasons for Prolog to use '//' for truncating integer
> division still apply equally well for Mercury.

Well, floating point division is not guaranteed to satisfy
X * (Y / X) = Y, so perhaps we should have a special name for that, too?

Personally, when the compiler informs me that I've used '/' where I
should have used '//', I don't think "Oh, yes!  I forgot this was
truncating integer division!"  I tend to think "Hnngngngn..." instead.

- Ralph
--------------------------------------------------------------------------
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