emacs-devel
[Top][All Lists]
Advanced

[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, 25 Apr 2018 21:17:39 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux)

>>>>> "Paul" == Paul Eggert <address@hidden> writes:

Paul> And it depends on what we mean by "unsafe". Is it safe to assume that
Paul> (eq (1+ 0) 1) returns t, for example? The Scheme standard says "no"
Paul> but we might decide that 'eq' should "work" for fixnums in Emacs
Paul> Lisp. That sort of thing.

I would like the "egal" idea to be at least considered: that is, for
immutable objects like bignums (and floats), have "eq" do a value
comparison, not an identity comparison.  Ideally we could dispense with
eql entirely.

The upside is that this makes programs simpler to reason about -- to my
mind the eq/eql distinction is letting an implementation leak through
the abstraction.

The downside is that this is less efficient.  (Currently my JIT emits
"eq" as a simple comparison, which is nice; but I think on the whole I'd
personally rather trade a bit of performance for the cleaner semantics.)

Tom



reply via email to

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