unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 72313@debbugs.gnu.org
Subject: bug#72313: 31.0.50; Warning about cl-member possibly being undefined when using cl-pushnew
Date: Sat, 27 Jul 2024 09:13:50 +0200	[thread overview]
Message-ID: <875xsrjoi9.fsf@gnu.org> (raw)
In-Reply-To: <jwv7cd7fhpr.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 27 Jul 2024 03:01:32 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

Hi Stefan,

>     (macroexpand-all '(cl-pushnew (list 1 2 3) s :test (lambda (_a _b) nil)))
> =>
>     (setq s
>      (let* ((va (list 1 2 3)))
>        (if (cl-member va s :test #'(lambda (_a _b) nil)) s (cons va s))))
>
>> My assumption is that (eval-when-compile (require 'cl-lib)) should be
>> fine when using only macros from cl-lib which in turn should expand
>> to cl-free code,
>
> That's not the case here (and a few other places).  In the past, I've
> moved some of this kind of code to `cl-preloaded`, so as to make
> things easier for programmers (to avoid them having to know which CL
> macros emit code which calls CL functions (and when)), but there are
> still cases like above, yes.

So the conclusion is to simply (require 'cl-lib) instead of
(eval-when-compile (require 'cl-lib))?  But how can the byte-compiler
conclude that cl-member might not be defined at runtime given that it's
an autoloaded function?

Addon question: should a package list cl-lib in Package-Requires if it
already requires an Emacs version where a good-enough cl-lib is included
anyway?

Thanks,
  Tassilo





  reply	other threads:[~2024-07-27  7:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26 20:29 bug#72313: 31.0.50; Warning about cl-member possibly being undefined when using cl-pushnew Tassilo Horn
2024-07-26 21:20 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27  7:01 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27  7:13   ` Tassilo Horn [this message]
2024-07-27  7:49     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27 15:29       ` Arash Esbati
2024-07-27 20:50         ` Tassilo Horn
2024-07-27 21:25           ` Arash Esbati
2024-07-31 17:44             ` Tassilo Horn
2024-07-31 19:55               ` Arash Esbati
2024-07-28  4:58           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875xsrjoi9.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=72313@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).