Subject: Re: bug#15814: 24.3.50; Signal error on malformed bindings in `cl-symbol-macrolet' (patch)

From: Stefan Monnier <[email-masked]>
Date: Tue, 05 Nov 2013 22:20:37 -0500

>> Good idea.  Could you try and use macroexp--warn-and-return instead, so
>> we get a file&line location when byte-compiling?
> I'm not certain what you mean here.  You seem to agree that this is an
> error, but `macroexp--warn-and-return' doesn't signal an error--it just
> prints a warning.  If we do something like this:

>   (let ((msg (format "Malformed `cl-symbol-macrolet' binding: %S"
>                      (car bindings))))
>     (macroexp--warn-and-return msg `(error "%s" ,msg)))

> we'll get a warning at compile time and an error at run time.  Is this
> what you have in mind?  Shouldn't we signal the error as early as
> possible?  Perhaps there is some Emacs convention that I'm not aware of
> in this regard.

Signaling an error stops the whole compilation, so you only get one
error at a time.  Better make it a warning, even though it is indeed
a programming error.

>> BTW, the same holds for the "let" sanity checks you added to cconv
>> (which should probably be moved to macroexp, now that I think about it,
>> so we can remove them from bytecomp.el).
> I don't understand this either.  By "moved to macroexp", do you just
> mean that the sanity checks should be performed using
> macroexp--warn-and-return in the manner given above?

No, I mean that they should be performed in macroexp--expand-all rather
than in cconv, so they're performed regardless of lexical-binding
(currently they're done once in cconv.el and once in bytecomp.el).

        Stefan