emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Warn about comparing quoted lists (etc) using `eq`


From: Dr. Arne Babenhauserheide
Subject: Re: Warn about comparing quoted lists (etc) using `eq`
Date: Thu, 15 Dec 2022 07:34:10 +0100
User-agent: mu4e 1.8.11; emacs 28.1

Juanma Barranquero <lekktu@gmail.com> writes:

> Note that your patch has a false positive with the empty string, which is 
> optimized to be always the same object (well, ISTR there are two, a unibyte
> one and a multibyte one).
>
> (byte-compile '(let ((x "")) (eq x "")))   =>   Warning: `eq' called with 
> literal string that may never match (arg 2)
>
> (let ((x "")) (eq x "")) => t

Is this guaranteed or just an implementation detail?

If it is not guaranteed, then "may never match" sounds correct.

I miss a suggestion, though: the warning as it is is not actionable. It
would be great if it could say something along the lines of

"... (arg 2). Consider using `equal'."

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

Attachment: signature.asc
Description: PGP signature


reply via email to

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