unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: Jonas Bernoulli <jonas@bernoul.li>, emacs-devel@gnu.org
Subject: Re: #'quoting functions when they are used as identifiers
Date: Sun, 27 Mar 2022 11:58:32 -0700	[thread overview]
Message-ID: <87zglbql2f.fsf@athena.silentflame.com> (raw)
In-Reply-To: <87bkxrh97s.fsf@bernoul.li>

Hello,

On Sun 27 Mar 2022 at 02:27pm +02, Jonas Bernoulli wrote:

> I was wondering whether it is wrong per se to function-quote a
> function-bound symbol if it serves as an argument to a function that
> does not actually call the argument as a function but for which it
> would never-the-less be a bug to be passed a symbol that isn't bound
> as a function.

I've struggled with this.  If you assume that sharpquote has the same
meaning (ignoring implementation) as the sharpquote in Common Lisp, then
I can give an answer.  Suppose that you are choosing between (f #'foo)
and (f 'foo).  Then

  - use #'foo if f will do something with the function object which may
    be invoked using (foo ...) in the lexical environment in which the
    (f #'foo) would occur

  - otherwise, use 'foo, because f will do something with the symbol
    `foo', but not its function binding.

> I am considering adding #'quotes because I would like to get that
> feedback from the byte-compiler.  On the other hand, one might argue
> that doing that is misleading to the human reader because the symbol
> is not actually intended to be called as a function, it just has to be
> a symbol that is fboundp, else there would be a bug (due to a typo or
> renaming).

According to the CL meaning for sharpquote, this wouldn't make sense.  I
think I'd find it confusing myself, but then, I write lots of CL.  I
really don't know how close the Emacs Lisp sharpquote is meant to be to
the CL sharpquote.

The technical difference is that CL doesn't have symbol function
indirection as described by (info "(elisp) Function Indirection").

-- 
Sean Whitton



  reply	other threads:[~2022-03-27 18:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-27 12:27 #'quoting functions when they are used as identifiers Jonas Bernoulli
2022-03-27 18:58 ` Sean Whitton [this message]
2022-03-28  0:50 ` Jonas Bernoulli
2022-03-28 14:09 ` Stefan Monnier
2022-03-28 15:22   ` [External] : " Drew Adams
2022-03-29 18:26   ` Jonas Bernoulli

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=87zglbql2f.fsf@athena.silentflame.com \
    --to=spwhitton@spwhitton.name \
    --cc=emacs-devel@gnu.org \
    --cc=jonas@bernoul.li \
    /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).