[Top][All Lists]

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

RE: humble proposal: New special form progn-1

From: Drew Adams
Subject: RE: humble proposal: New special form progn-1
Date: Wed, 27 Jul 2016 08:15:17 -0700 (PDT)


I would have no use for that, and I would find code that uses it
harder to read than what I would normally write.

In fact, I rarely use `prog1', `prog2', or `progn' - less than 0.1%
of code lines for `prog1', .02% for `prog2', and 0.5% for `progn'.

And all of the `prog2' lines, and some of the others, are only for
code that mirrors some code distributed by Emacs (e.g., so that
subsequent updates/diffs are easier).  IOW, it's really someone
else's ugly code. ;-)

I use `prog1' for the swapping idiom (which might be clearer as a
`swap-values' macro, but which is ingrained in me and easy to see):

 (setq start  (prog1 end (setq end  start)))

and sometimes for a return-value computation that is followed by
some side effect such as showing a message.

But for most cases where someone else might use `prog1' I'm already
let-binding a variable that I use for the value that might otherwise
be returned by the `prog1' (or by a `prog2').

 (let (... result) ... (setq result ...) ... result)

And I rarely use `progn' with `if', preferring `when', `unless',
`and', `or', or `cond' for most such use cases.

Just one opinion.

reply via email to

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