[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: Stefan Monnier
Subject: Re: Using the GNU GMP Library for Bignums in Emacs
Date: Mon, 09 Jul 2018 16:15:52 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> 2. What is (type-of 5)?  Right now 'integer, but arguably perhaps
>>     'fixnum is correct.  Gerd's branch did this.
> 'integer', for the same reason that (type-of 5) doesn't return
> 'natnum'. fixnum and natnum are both subtypes of integer, and the basic type
> is integer.  The other ways of doing this would cause more trouble to
> user code.

I think it'd be wrong for (type-of 5) to return the same value as
(type-of <BIGNUM>), especially as long as `eq` doesn't treat bignum
the same as fixnums.

Also, for purposes of cl-generic's dispatch it'd be better for type-of
to return `natnum` or `fixnum` when applicable.

Grepping through Elisp code, `type-of` is very rarely used and it's even
more rare for those uses to depend on the value returned for small
integers, but I did find a few such cases, so it's indeed safer to just
keep returning `integer` for small integers (and probably some other value
for bignums, such as `bignum`).


reply via email to

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