unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Deniz Dogan'" <deniz.a.m.dogan@gmail.com>, <gebser@mousecar.com>
Cc: 'GNU Emacs List' <help-gnu-emacs@gnu.org>
Subject: RE: (goto-char ...) error
Date: Tue, 22 Feb 2011 12:55:13 -0800	[thread overview]
Message-ID: <181FF19F20EC4739B0AF6EF454853C68@us.oracle.com> (raw)
In-Reply-To: <AANLkTikus9qg5p0nMY=3Yuv61oZ7_1TQFsBaqRKRoraw@mail.gmail.com>

> This is fine, but when you don't need the ELSE clause, it's usually
> better to use `when', which is like `if', except it doesn't have an
> ELSE and you don't need to use `progn'.

FWIW - Some people, including me, use `when' and `unless' to indicate to human
readers that the return value is unimportant: only side effects are of interest.

To indicate (to humans) that the return value is used, I use `if', `and', `or',
`cond', or `case'.  That makes the code simpler to read, assuming I didn't lie
or make a mistake: Whenever you see `when' or `unless' you can forget about the
return value; whenever you see `if', `and', or `or' you know the return value is
probably used in some way.

Other people, including those who maintain Emacs, apparently do not follow this
convention for the most part.  I have no idea how widespread the convention is.
I picked it up long ago when using Common Lisp.

"Common Lisp The Language" says this (at least in my 1984 copy, now far out of
date), for example:

"As a matter of style, `when' is normally used to conditionally produce some
side effects, and the value of the `when'-form is normally not used.  If the
value is relevant, then it may be stylistically more appropriate to use `and' or
`if'."




  reply	other threads:[~2011-02-22 20:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-22 16:47 (goto-char ...) error ken
2011-02-22 17:31 ` Deniz Dogan
2011-02-22 18:24   ` ken
2011-02-22 18:45     ` Deniz Dogan
2011-02-22 19:22       ` ken
2011-02-22 19:45         ` Deniz Dogan
2011-02-22 20:55           ` Drew Adams [this message]
     [not found]       ` <mailman.1.1298402588.16069.help-gnu-emacs@gnu.org>
2011-02-22 22:50         ` Tim X
     [not found]   ` <mailman.11.1298399070.22047.help-gnu-emacs@gnu.org>
2011-02-22 22:27     ` Tim X
     [not found] <mailman.3.1298393577.375.help-gnu-emacs@gnu.org>
2011-02-22 22:15 ` Tim X

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=181FF19F20EC4739B0AF6EF454853C68@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=deniz.a.m.dogan@gmail.com \
    --cc=gebser@mousecar.com \
    --cc=help-gnu-emacs@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).