|
From: | Paul Eggert |
Subject: | Re: Using the GNU GMP Library for Bignums in Emacs |
Date: | Mon, 9 Jul 2018 16:25:24 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
Stefan Monnier wrote:
Isn't the issue of how finely type-of distinguishes integers separable from the issue of whether to have bignums? type-of could return 'natnum' now, even without bignums, but it doesn't. If we decide that type-of should return some value other than 'integer' for some integers, how would we decide what value to return? For example, if (natnump X) and (bignump X) both succeed, should type-of return 'natnum' or 'bignum' or both?Also, for purposes of cl-generic's dispatch it'd be better for type-of to return `natnum` or `fixnum` when applicable.
All in all I expect Elisp would be a bit easier to use and explain if it treats 'integer' as the fundamental type, and 'characterp', 'fixnump', 'bignump', 'natnump' as predicates that succeed on only some members of that type.
it's indeed safer to just keep returning `integer` for small integers (and probably some other value for bignums, such as `bignum`).
Why the latter? That is, when would it be useful in existing code for (type-of X) to return a value other than 'integer' when (integerp X) returns t?
[Prev in Thread] | Current Thread | [Next in Thread] |