Dr Alan Watson wrote:
> I think the major difference between us on this issue
> is that you think that modular fixnum arithmetic is
> adequate for the base language whereas I do not.
I think the major difference between us is what we
mean by the word "adequate". I want the base language
to be adequate to support a portable implementation of
the full numeric tower. I don't fully understand what
you mean by adequate, because I don't think you have
yet explained yourself.
> I want exact integers of unlimited size because I can
> see an argument[*] for making fixnums smaller than the
> size needed to reference the largest possible list,
> string, or vector, and I cannot imagine the base
> language not completely defining these operations.
>
> [*] For example, making fixnums 16-bits wide on a
> 32-bit machine to allow for quick determination of
> overflow on multiplication.
SRFI-77 allows the fixnum range to be as small as
[0, 1], independently of the range needed to reference
lists, strings, and vectors. Nothing in SRFI-77 even
suggests that implementations are forbidden to support
exact integers beyond the fixnum range in their base.
Indeed, SRFI-77 is written as though the base will
include the full numeric tower.
It seems, therefore, that some of your worries are
(ahem) baseless.
> I also like the idea of the arithmetic operations
> following standard arithmetic rather than modular
> arithmetic.
Unlimited precision integer arithmetic is useful.
So is modular arithmetic.
In any implementation that already has unlimited
precision integers, adding the fixnum primitives
of SRFI-77 is absolutely trivial. We don't need
to worry about those systems.
What we have to worry about are the systems that
provide nothing beyond modular arithmetic and
flonums. Some implementors of those systems have
told me they do not want to support unlimited
precision integer arithmetic in their base language.
SRFI-77 was designed to make it possible to write
portable code that uses the full tower even in
systems whose implementors don't want to bother
with it. All the implementors have to provide is
the fixnum/flonum base, and virtually all of them
can do that with little or no extra effort.
Will