|
From: | Paul Eggert |
Subject: | Re: Using the GNU GMP Library for Bignums in Emacs |
Date: | Tue, 10 Jul 2018 20:30:51 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
Stefan Monnier wrote:
There's no need to explain the difference between `integer` and `bignum` here, just like we don't explain the difference between `subr` and `compiled-function`.
subr and compiled-functions are distinct (nonintersecting) types, whereas bignum is a subset of integer, so these are quite different cases. The manual says "each object belongs to one and only one primitive type; ‘type-of’ tells you which one". But if type-of returned 'integer' and bignums are integers (which they should be), this statement in the manual would become false, and would need to be rewritten. I don't see this as a win.
I think I'm missing a reality check here. We are talking about `type-of`, right? Have you looked at how many times it's used in Elisp?
True, it's pretty rare. And it is a relic of the old-fashioned days when types were all disjoint. (Maybe we should remove 'type-of'? :-)
I'm not all that worried about type-of. I am more worried about the idea that bignums are second-class integers. When at all possible, bignums should be treated the same way that any other (large) integer is treated. For example, aref should report that a bignum index is out of range (if it is indeed out of range) rather than reporting a type error.
[Prev in Thread] | Current Thread | [Next in Thread] |