Subject: Re: bug#11938: 24.1.50; Some not so useful CL related byte compiler warnings

From: Stefan Monnier <[email-masked]>
Date: Wed, 18 Jul 2012 06:25:16 -0400

> If I byte compile it, I get the following warnings:

> progv-bug.el:7:37:Warning: global/dynamic var `body' lacks a prefix
> progv-bug.el:10:25:Warning: reference to free variable `a'
> progv-bug.el:10:27:Warning: reference to free variable `b'
> progv-bug.el:11:35:Warning: reference to free variable `year'
> progv-bug.el:19:1:Warning: `labels' is an obsolete function (as of 24.2); use
>     `(quote cl-labels)' instead.

Yay!!  So there are progv users after all!  Amazing!

> In detail:
>   progv-bug.el:7:37:Warning: global/dynamic var `body' lacks a prefix
> Dunno what that means, the code doesn't include such a variable.

Yes, it's a bug of my new progv code, which introduces this var.
Should be fixed now, thank you.

>   progv-bug.el:10:25:Warning: reference to free variable `a'
>   progv-bug.el:10:27:Warning: reference to free variable `b'
>   progv-bug.el:11:35:Warning: reference to free variable `year'

> Not very useful, since the variables' values are never looked up
> before they are bound, but ok, I can live with it.

Yes, I think these warnings were already present with Emacs-24.1's
version of progv.
I'm curious, actually.  What does Common-Lisp do with something like:

  (let ((a 2)) (progv '(a b) '(1 2) a))

does it return 2 (the value of the lexically-scoped var `a') or 1?
If it should return 1, what about:

  (let ((a 2)) (progv '(b) '(1) a))

In any case, for all uses of progv where the first arg is a constant,
you'd be much better off using pcase-let (or destructuring-bind or
multiple-value-bind).
So maybe you're not a user of progv after all.

>   progv-bug.el:19:1:Warning: `labels' is an obsolete function (as of 24.2); use
>       `(quote cl-labels)' instead.
> What does `(quote cl-labels)' mean?  I guess this should be just
> `cl-labels'.

Indeed, that was a copy&paste typo, thank you for catching it,

        Stefan