[Top][All Lists]

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

if vs. when vs. and: style question

From: Marcin Borkowski
Subject: if vs. when vs. and: style question
Date: Mon, 23 Mar 2015 23:53:02 +0100

Hi there,

assuming (e1) and (e2) are some expressions, all three forms:

(if (e1) (e2))

(when (e1) (e2))

(and (e1) (e2))

are semantically equivalent.  Which one is better style (and when)?
I would guess that =when= is better iff (e2) is a =progn= (since we can
drop the =progn= altogether, and this seems to be the point of =when=),
and =and= might be considered better (well, maybe) by some people when
both (e1) and (e2) are very short (though I personally would avoid that,
since =if= seems easier for a human to understand at a first glance).
Am I right?

Notice: by “better” I mean “more idiomatic”, or “easier/faster to read
for a human”, or “more likely to be used by an experienced Elisp
hacker”, etc.


Marcin Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

reply via email to

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