[Top][All Lists]

[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

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


reply via email to

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