unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Phil Sainty <psainty@orcon.net.nz>, emacs-devel@gnu.org
Subject: RE: humble proposal: New special form progn-1
Date: Wed, 27 Jul 2016 08:15:17 -0700 (PDT)	[thread overview]
Message-ID: <54a95c7d-a709-4dba-b72b-68fbd063a916@default> (raw)
In-Reply-To: <5798C59D.8000308@orcon.net.nz>

FWIW -

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	other threads:[~2016-07-27 15:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 12:16 humble proposal: New special form progn-1 Tino Calancha
2016-07-27 12:22 ` Stefan Monnier
2016-07-27 12:53 ` Andreas Schwab
2016-07-27 13:58   ` Tino Calancha
2016-07-27 16:04     ` Andreas Schwab
2016-07-27 14:08 ` Clément Pit--Claudel
2016-07-27 14:30   ` Phil Sainty
2016-07-27 15:15     ` Drew Adams [this message]
2016-07-28 11:35       ` Tino Calancha
2016-07-27 14:38   ` Tino Calancha
2016-07-27 19:07     ` Clément Pit--Claudel
2016-07-27 21:51       ` Nicolas Petton

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=54a95c7d-a709-4dba-b72b-68fbd063a916@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=psainty@orcon.net.nz \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).