[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: hash-consing bignums and eq==eql
From: |
Stefan Monnier |
Subject: |
Re: hash-consing bignums and eq==eql |
Date: |
Wed, 29 Aug 2018 16:50:33 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> This keeps 'eq' fast, and causes eq to start to "work" on floats whose
> bottom few bits are zero.
>> the distinction between eq and eql for integers leads to subtle bugs that
>> are best excluded by design, IMHO.
> Common Lisp and Scheme both have this distinction, and they seem to be doing
> OK. In this particular tradeoff between performance and nicer behavior, most
> Lisp users seem to prefer performance.
FWIW, I think this is a historical mistake and makes for many programs
being fundamentally yet unnecessarily not platform-independent (although
of course in practice the problem rarely manifests itself).
If you take EQ==EQL as a starting point, I think it's always reasonably
easy to get performance close enough to what you can get with a "faster
EQ".
Actually, I'm not opposed to having a low-level "fast equality test".
What I dislike is that this fast equality test be so prominent that we
encourage its use as the *standard* test, instead of keeping its use for
particular cases where the speed actually matters.
IOW, I'd be OK with:
(defalias 'fast-eq (symbol-function 'eq))
(defalias 'eq (symbol-function 'eql))
[ and its equivalent in C. ]
Stefan
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, (continued)
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Stefan Monnier, 2018/08/23
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Pip Cet, 2018/08/24
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Paul Eggert, 2018/08/24
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Pip Cet, 2018/08/25
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Stefan Monnier, 2018/08/25
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Paul Eggert, 2018/08/25
- hash-consing bignums and eq==eql, Stefan Monnier, 2018/08/28
- Re: hash-consing bignums and eq==eql, Pip Cet, 2018/08/29
- Re: hash-consing bignums and eq==eql, Stefan Monnier, 2018/08/29
- Re: hash-consing bignums and eq==eql, Paul Eggert, 2018/08/29
- Re: hash-consing bignums and eq==eql,
Stefan Monnier <=
Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Pip Cet, 2018/08/22