[Top][All Lists]

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

RE: (goto-char ...) error

From: Drew Adams
Subject: RE: (goto-char ...) error
Date: Tue, 22 Feb 2011 12:55:13 -0800

> 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

reply via email to

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