Subject: Re: bug#6750: Byte compiler: spurious message "cl used at runtime"

From: Juanma Barranquero <[email-masked]>
Date: Thu, 29 Jul 2010 21:51:28 +0200

On Thu, Jul 29, 2010 at 21:03, Alan Mackenzie <[email-masked]> wrote:

> Or, perhaps you could indulge me a little, and show an example of mapcan
> (or some other cl function) which isn't "use at runtime".

;; at top level
(eval-when-compile
   (mapcan ...))

> I put it to you that that error message is not, in general, helpful.  I
> think it should be restricted to uses of mapcan at runtime (in a defun)
> or when it's in the form generated by a macro.

But the point is that the macro could be called at runtime and
`mapcan' would not be defined.

Try byte-compiling test.el:
--------------------------------------------------------------------------------
(eval-when-compile (require 'cl))

(defmacro mapcan-at-runtime ()
  `(setq sample ',(mapcan 'identity '((a) (b) (c)))))
--------------------------------------------------------------------------------

(which produces the warning), and then

emacs -Q -l test.elc
M-: (mapcan-at-runtime) <RET>

    Juanma