emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setq's with missing final arguments.


From: Oleh Krehel
Subject: Re: setq's with missing final arguments.
Date: Sun, 22 Nov 2015 13:35:45 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Alan Mackenzie <address@hidden> writes:

> Consider this file:
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> (defvar foo t)
> (defvar bar t)
>
> (defun bad-setq ()
>   "Doc string"
>   (setq foo 5
>       bar))
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> In the setq, there is a missing argument after "bar".  At the moment,
> the byte compiler just generates code to assign nil to bar, without
> giving any warning.  IMAO, this is Very Bad.

In my opinion, multi-variable setq should be deprecated altogether.  I'm
sure many people will disagree for the reasons of habit, but
multi-variable setq is just plain bad: it makes LISP less lispy that it
should be. For example: "(setq bar)" is a nice sexp: you can delete it,
copy it, comment it, move it around - all kinds of fast, productive and
clear to see things. On the other hand, "bar" is simply a part of
another expression, you can do way less things with it, and you can
break things in bad ways if you're not careful. It's an unnecessary
mental burden on the programmer.

Just my two cents. I understand very well there's only 0.1% chance to
get this behavior deprecated because reasons. But a man can dream.  And
at least I can enforce this restriction on the contributions to my
packages.

    Oleh



reply via email to

[Prev in Thread] Current Thread [Next in Thread]