This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: bug #27553 - patch
On 04/11/2011 11:09 PM, Helmut Eller wrote:
* Per Bothner [2011-04-12 01:30] writes:
I don't know if the current behavior is a good idea - but it is intentional.
The meaning of (/ 1 0) is the same as the literal 1/0, which is "exact
infinity".
R6RS, section 11.7.4.3, says quite clearly: "If all of the arguments are
exact, then the divisors must all be nonzero". There are even examples
in R6RS for (/ 0 0) and (/ 3 0) with an&assertion exception as the
expected outcome.
R6RS is not a specification for Kawa, which has a number of extensions
(and some incompatibilities) beyond R6RS. Remember, Kawa predates R6RS.
At some point, when we have more of R6RS functionality implemented,
I want to have a "pedantic strictly standards-conforming" mode (option),
but Kawa by default will not be in that mode.
OTOH we avoid gratuitous incompatibilities with R6RS and other standards.
And one can reasonably argue that while defining 1/0 as "exact positive
infinity" can be useful - it can also be rather confusing. A possible
compromise is to have an ExtendedIntNum type that includes infinities,
but not allow (/ 1 0). While I can think of uses for an "infinity"
pseudo-integer, it harder to think of a use for (/ 1 0).
This has some uses - for example the length of an infinite list is (or
should
be) infinity. A range a..1/0 where the upper bound is infinity is a
range which
starts with the lower bound and continues forever. This can also be a
convenience
for substring/slicing operations.
Using -1 for this would be less exotic IMO.
That would be very wrong mathematically. The range a..-1
is very different from a..infinity.
--
--Per Bothner
per@bothner.com http://per.bothner.com/