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

From: Alan Mackenzie <[email-masked]>
Date: Thu, 29 Jul 2010 19:03:06 +0000

Hi, Stefan,

On Thu, Jul 29, 2010 at 01:01:46AM +0200, Stefan Monnier wrote:
> > In this macro declaration:

> >     (defmacro c-declare-lang-variables ()
> >       `(progn
> >          ,@(mapcan (lambda (init)
> >                      `(,(if (elt init 2)
> >                             `(defvar ,(car init) nil ,(elt init 2))
> >                           `(defvar ,(car init) nil))
> >                        (make-variable-buffer-local ',(car init))))
> >                    (cdr c-lang-variable-inits))))

> > , (from cc-engine.el), the byte-compiler gives this warning:

> >     "Function `mapcan' from cl package called at runtime".

> > It is clear that the mapcan, being within a ,@ construct, does its work
> > at macro-expansion time, i.e. compile time.

> > Thus the warning message is wrong.  This is a bug.

> This macro will be in the .elc.  This means it can be called "at run
> time" (e.g. if you do M-: (c-declare-lang-variables ...) RET).

That brought a smile to my face.  It's pure sophistry. :-)  With no more
creativity than you've just shown, ANY use of mapcan could be "shown" to
be "use at runtime".  So why not shorten the warning message to

    "Function `mapcan' from cl package was used"
    
?  ;-)

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".  You know as
well as I do, that there's no rigid separation of Lisp into compilation
and running phases.

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.

I'm trying to get rid of warnings messages in CC Mode.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).