From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Robert Pluim <rpluim@gmail.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
Bozhidar Batsov <bozhidar@batsov.dev>,
akater <nuclearspace@gmail.com>,
Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Codifying some aspects of Elisp code style and improving pretty printer
Date: Fri, 01 Oct 2021 11:26:51 -0400 [thread overview]
Message-ID: <jwv1r54rcxc.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87a6js253t.fsf@gmail.com> (Robert Pluim's message of "Fri, 01 Oct 2021 16:26:46 +0200")
> Apropos, I believe the current recommendation is to do
> (mapconcat #'identity seqs " ")
> rather than
> (mapconcat 'identity seqs " ")
> ie function-quoting the argument to mapconcat, apply, mapc etc, but
Indeed, the main benefit being that the byte-compiler can warn you if
the function is not known to be defined (typically because of a typo or
a missing `require`).
A side benefit is that it "does the right thing" for `cl-flet` and friends.
> 1. The elisp manual doesnʼt say that in (info "(elisp) Mapping Functions")
Not sure that'd be the best place, but we should probably adjust the
manual to encourage the use of #' to quote function names,
> 2. Emacs' code itself doesnʼt do that consistently
The difference is sufficiently unimportant that I don't see a need to
try and make it consistent in this respect. E.g. I do change 'foo to
#'foo quite often, but only as part of other changes.
> (and we have the odd #'(lambda ...) as well
I don't see anything wrong with #'(lambda...)
[ I personally prefer to skip the #' to make the code (marginally)
shorter, but it's purely a matter of taste and I usually try and
refrain from making this change in existing code unless it helps make
the code fit into 80 columns. ]
> 3. The byte compiler doesnʼt warn about it.
Mine does ;-)
But I wouldn't want to enable such a warning by default (or at least it
should be mess a bit less eager than it is, because of the occasional false
positives).
> I believe it helps the byte-compiler generate better code, but donʼt
> know what the actual effect is.
It has no effect on the generated code.
Stefan
next prev parent reply other threads:[~2021-10-01 15:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-29 18:01 Codifying some aspects of Elisp code style and improving pretty printer akater
2021-09-30 7:02 ` André A. Gomes
2021-09-30 11:26 ` Bozhidar Batsov
2021-09-30 15:15 ` akater
2021-10-01 7:05 ` Lars Ingebrigtsen
2021-10-01 14:20 ` Stefan Monnier
2021-10-01 14:43 ` Lars Ingebrigtsen
2021-10-01 14:26 ` Robert Pluim
2021-10-01 15:26 ` Stefan Monnier [this message]
2021-10-01 16:15 ` Robert Pluim
2021-10-01 17:08 ` Stefan Monnier
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=jwv1r54rcxc.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=bozhidar@batsov.dev \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
--cc=nuclearspace@gmail.com \
--cc=rpluim@gmail.com \
/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).