[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using the GNU GMP Library for Bignums in Emacs

From: Helmut Eller
Subject: Re: Using the GNU GMP Library for Bignums in Emacs
Date: Tue, 10 Jul 2018 21:14:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On Tue, Jul 10 2018, Paul Eggert wrote:

>> Some important functions only for fixnums but not for bignums.
>> E.g. goto-char or aref.
> Both of these functions have limits that are not relevant to fixnums;
> they have limits based on something else. For example, goto-char is
> limited to point-min..point-max, and aref is limited to
> 0..length-1. We will want both functions to work on bignums, since we
> will want to allow buffer sizes and bool vector lengths that do not
> fit into fixnums.

Speak for yourself.  I certainly don't want goto-char or aref to work on
bignums.  I bed 200 dollars that Emacs will not support buffer sizes or
array lengths beyond most-positive-fixnum within the next year.

And I would be surprised if Emacs would switch to bignums for functions
like, current-time of file-attributes, where it would actually make
sense to use bignums.

> And even if these functions' limits were relevant to fixnums, I don't
> see why one would want to specialize a method just for fixnums as
> opposed to settling for specializing it to integers. The method would
> accept an integer, and then if it used a fixnum-only goto-char or aref
> that would signal an error, just as it would for any other
> out-of-range integer. There would be no need to specialize the method
> to fixnums.

If we follow that argumentation, then no method would ever need any
specialization.  The method would accept any type and then if something
doesn't work for the actual type it would signal an error.

> So I'm still not seeing the actual use cases that would suggest that
> (type-of 5) should not continue to return 'integer'.

To write reasonable programs, programmers need to have reasonable models
of how computers work and in particular they need to now how data types
are physically represented.  That's why some programmers want know if a
sequence is a list or a vector or if a number is a fixnum, a flonum, or
a bignum.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]