all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* #'quoting functions when they are used as identifiers
@ 2022-03-27 12:27 Jonas Bernoulli
  2022-03-27 18:58 ` Sean Whitton
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jonas Bernoulli @ 2022-03-27 12:27 UTC (permalink / raw)
  To: emacs-devel

Hi,

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.

An imperfect example would be the arguments to `derived-mode-p'.  I
don't plan to #'quote the arguments to that function but am considering
doing it for a few similar functions (from my `transient' package) for
which a prefect match exists between the name of the function and the
"symbol as an identifier".

The documentation says that ‘function’

     returns FUNCTION-OBJECT without evaluating it.  In this, it is
     similar to ‘quote’.  But unlike ‘quote’, it also serves as a note
     to the Emacs evaluator and byte-compiler that FUNCTION-OBJECT is
     intended to be used as a function. [...]

     When FUNCTION-OBJECT is a symbol and the code is byte compiled, the
     byte-compiler will warn if that function is not defined or might
     not be known at run time.

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

(I am not suggesting that we do this in Emacs.)

     Thanks for your thoughts!
     Jonas



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-03-29 18:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-27 12:27 #'quoting functions when they are used as identifiers Jonas Bernoulli
2022-03-27 18:58 ` Sean Whitton
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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.