[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: Tue, 10 Jul 2018 23:42:28 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> 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.

Actually, the incorrect statement would be when (type-of 5) returns
`integer` since `integer` wouldn't be a primitive type any more.

> 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'? :-)

FWIW, I dislike type-of and would be happy to get rid of it (and
replace it with a cl-generic-specific function instead which would fix
some of its shortcomings for that use-case).

> 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.

Fully agreed.  I just see `type-of` as a function that reports about the
actual representation so it's OK for it to reveal differences which will
rarely affect normal code.


reply via email to

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