From: Oleh Krehel <ohwoeowho@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: Jordon Biondo <jordonbiondo@gmail.com>,
rms@gnu.org, Stefan Monnier <monnier@IRO.UMontreal.CA>,
emacs-devel@gnu.org
Subject: Re: giving `setq-local' the same signature as `setq'
Date: Thu, 19 Mar 2015 16:55:39 +0100 [thread overview]
Message-ID: <87vbhx2d8k.fsf@gmail.com> (raw)
In-Reply-To: <7455a7dd-8c32-4681-95a0-6d09f50ac169@default> (Drew Adams's message of "Thu, 19 Mar 2015 08:39:39 -0700 (PDT)")
Drew Adams <drew.adams@oracle.com> writes:
>> I very much prefer the only-one-variable-per-setq style.
>
> You're in luck then. You have the choice. ;-)
What I meant to say that I very much prefer the
only-one-variable-per-setq style when interacting with other people's
code. Obviously, I don't use this notation in my own code.
>
> You can do the same for `let*', if you like:
>
> (let ((foo fooval))
> (let ((phlop phlopval))
> (let ((toto totoval))
> ...)))
>
Now you've just lead yourself into a trap. This is similar to
one-var-per-setq:
(let* ((foo fooval)
(phlop phlopval)
(toto totoval))
...)
This is similar to multi-var-per-setq:
(let* (foo fooval
phlop phlopval
toto totoval)
...)
It already looks bad for single symbol statements. Imagine how bad it
would be if they were more complex.
>> It shows much more clearly where the variable is.
>
> Where the variable is? How so? (Where is it? Where's Waldo?)
Obviously, the variable is by the big fat left paren.
>> It also gives an anchor to quickly navigate to the variable
>> to get its value.
>
> How so? Please elaborate.
With C-M-n and C-M-p you can navigate to the big fat paren by which the
variable resides (after setq).
>> In a setq list of 10 items, by item 5 it is already unclear which is the
>> variable and which is the value. In my opinion, it's not worth
>> complicating the code maintenance just to save a few chars.
>
> This is why it is good that you have the choice.
You're wrong here. I don't have the choice. Just yesterday I was debugging my
AUCTEX config. It wasn't pleasant to navigate 5-variable setq
statements, some of which took the whole page.
> I find it clearer to let `setq' do the grouping, instead of implicit or
> explicit `progn'. But I put each var & value pair on a separate line:
>
> (setq foo fooval
> phlop phlopval ; Maybe this one needs a comment.
> toto totoval)
>
> I don't do this to save characters (e.g. for typing). I do it to make
> the code clearer and maintenance less error prone and easier. For me,
> at least.
Imagine that you want to comment out `phlop phlopval', which is a
multi-line statement. If it was bounded by parens, you could do it in an
easy and error-free way. Otherwise, you have to manually select the region.
Oleh
next prev parent reply other threads:[~2015-03-19 15:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-18 15:26 giving `setq-local' the same signature as `setq' Jordon Biondo
2015-03-18 16:24 ` Stefan Monnier
2015-03-19 14:08 ` Richard Stallman
2015-03-19 14:48 ` Jordon Biondo
2015-03-19 15:11 ` Drew Adams
2015-03-19 15:17 ` Oleh Krehel
2015-03-19 15:39 ` Drew Adams
2015-03-19 15:55 ` Oleh Krehel [this message]
2015-03-19 17:25 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vbhx2d8k.fsf@gmail.com \
--to=ohwoeowho@gmail.com \
--cc=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
--cc=jordonbiondo@gmail.com \
--cc=monnier@IRO.UMontreal.CA \
--cc=rms@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.