Subject: Re: bug#20241: 25.0.50; `setq' with only one argument

From: Alan Mackenzie <[email-masked]>
Date: Wed, 25 Nov 2015 20:58:51 +0000

Hello, John.

On Wed, Nov 25, 2015 at 11:40:15AM -0800, John Wiegley wrote:
> >>>>> Artur Malabarba <[email-masked]> writes:

> > This is a bug then (probably in the advertised-calling-convention of
> > funcall). Functions called with the wrong number of arguments are usually
> > reported as warnings by the byte-compiler.

> Ok, let's go with this then:

>     Evaluation:  Run-time error
>     Compilation: Compile-time warning
>     Execution:   Run-time error (same as Evaluation)

I can live with that.

> I think that's the convergence point for the three of us, amirite?

Things are never that simple.  In evaluation, we now get the signal
"wrong-number-of-args setq 17".  The first eight set operations are not
carried out.

In compilation, currently a warning message (called an "Error") is
emitted, and code is generated to perform 9 set operations (the last one
to nil).  This needs to change.

How about enhancing the definition of setq to say that with 17
arguments, NONE of the assignments are done?  This should be relatively
straight forward to code up in the byte compiler, even in the lexical
binding case.

Or, alternatively, we could explicitly say that whether the first 8
assignments are carried out before signaling the error is undefined.
This should deter over-clever hackers from trying to catch the
wrong-number-of-args error, expecting the code to have done something
predictable.

> John

-- 
Alan Mackenzie (Nuremberg, Germany).