Subject: Re: bug#36403: 27.0.50; Trivial image.c bugs

From: Pip Cet <[email-masked]>
Date: Fri, 21 Aug 2020 09:26:10 +0000

On Thu, Aug 20, 2020 at 11:32 PM Lars Ingebrigtsen <[email-masked]> wrote:
>   for (img = c->buckets[i]; img; img = img->next)
>      if (img->hash == hash
> -       && !NILP (Fequal (img->spec, spec))
> +       && !equal_lists (img->spec, spec)
>         && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f)
>         && img->frame_background == FRAME_BACKGROUND_PIXEL (f))
>
> I guess the !NILP (Fequal...) idiom tainted the rewrite...

I can confirm it did. However, my stupidity is not a very good
argument for changing Emacs, or all of it would need changing :-)

> I've often wondered why we use !NILP instead of, like TRUEP or
> something.  !NILP doesn't feel very natural.

Paul's suggestion was to use equal () instead of !NILP (Fequal (...)).
I'm against that, because the F in Fequal kind of hints at the
difficulties of using equal, of which there are many: in the current
implementation, it can signal, quit, be asymmetric (signalling for
(equal a b) whereas (equal b a) works), and is susceptible to equality
bombs that take forever to compare.  It cannot call Lisp, yet, but I
wouldn't be surprised if that changes. It's really not a function you
should use from C very often, and using it as a hash table predicate
is often the wrong thing to do.

Replacing !NILP is a better idea, but I'm struggling to come up with a
good name for that. But even a bad name would be an improvement.