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: Ihor Radchenko
Subject: Re: Warn about comparing quoted lists (etc) using `eq`
Date: Thu, 15 Dec 2022 10:50:37 +0000

Mattias Engdegård <mattias.engdegard@gmail.com> writes:

> While this sounds like a useful suggestion on the surface, it's actually 
> slightly dangerous: blindly replacing `eq` with `equal` (and `memq` with 
> `member`, and so on) may very well break working code (that silently relied 
> on the condition not being true). It's also a poor remedy against pratfalls 
> like
>
>   (memq x '(one 'two 'three))
>
> which do occur. What we really want is to make a human look at the code, and 
> think.

Then, there should also be a way to tell the compiler not to throw the
warning in specific, checked, places in the code.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

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