[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: Tom Tromey
Subject: Re: Using the GNU GMP Library for Bignums in Emacs
Date: Wed, 11 Jul 2018 22:51:09 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux)

>>>>> "Richard" == Richard Stallman <address@hidden> writes:

Richard> [[[ To any NSA and FBI agents reading my email: please consider    ]]]
Richard> [[[ whether defending the US Constitution against all enemies,     ]]]
Richard> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]

>> Well, for one thing, it's simpler to explain that there are just
>> integers.  In fact after working on the docs for this I think it would
>> be better if bignums were interned so that eq would work.

Richard> Simplifying the documentation is often a good reason to change the
Richard> Emacs Lisp language.  But it is not automatically decisive.  In this
Richard> case, there may be important advantages on the other side too.

Yeah, I just don't know what those advantages are; or maybe they were
explained and I missed and/or did not understand them.

Speaking of downsides, I think there is at least one downside of making
'eq' work for bignums, which is that it is slower.

One way to implement this would be to intern each mpz_t in some sort of
weak hash table.  This isn't hard to implement but it means a hash
lookup whenever converting a bignum to a Lisp object.

Another way would be to add a special case to eq, though as you said
earlier, this would slow down eq.

I don't know which would be better and I haven't implemented either one.
Instead I plan to push my branch to savannah soon, and then I will send
out an email and everybody can take a look at it and see what they think
about the documentation and the implementation.


reply via email to

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