unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73886: 29.4; Confusing info about void function cells in Emacs Lisp manual
@ 2024-10-19 14:37 Ulrich Müller
  2024-10-19 17:45 ` Eli Zaretskii
  2024-10-19 19:08 ` Andreas Schwab
  0 siblings, 2 replies; 4+ messages in thread
From: Ulrich Müller @ 2024-10-19 14:37 UTC (permalink / raw)
  To: 73886

Section 13.9 "Accessing Function Cell Contents" of the GNU Emacs Lisp
Reference Manual emphasizes the distinction between void and nil
in function cells:

|    Note that void is not the same as ‘nil’ or the symbol ‘void’.
| The symbols ‘nil’ and ‘void’ are Lisp objects, and can be stored into
| a function cell just as any other object can be (and ‘void’ can be a
| valid function if you define it with ‘defun’).  A void function cell
| contains no object whatsoever.

|    You can test the voidness of a symbol's function definition with
| ‘fboundp’.  After you have given a symbol a function definition, you
| can make it void once more using ‘fmakunbound’.

Also, for "fboundp":

|      This function returns ‘t’ if the symbol has an object in its
|      function cell, ‘nil’ otherwise.  It does not check that the
|      object is a legitimate function.

It seems that the actual behavior does not reflect this, i.e. there
is no distinction between nil and void:

   (fmakunbound 'foo)
   (fboundp 'foo) ⇒ nil

   (fset 'foo nil)
   ;; according to the manual, the following should return t
   ;; because nil is a Lisp object:
   (fboundp 'foo) ⇒ nil

Is the manual wrong, or am I missing something?





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

* bug#73886: 29.4; Confusing info about void function cells in Emacs Lisp manual
  2024-10-19 14:37 bug#73886: 29.4; Confusing info about void function cells in Emacs Lisp manual Ulrich Müller
@ 2024-10-19 17:45 ` Eli Zaretskii
  2024-10-19 19:08 ` Andreas Schwab
  1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-10-19 17:45 UTC (permalink / raw)
  To: Ulrich Müller, Stefan Monnier; +Cc: 73886

> From: Ulrich Müller <ulm@gentoo.org>
> Date: Sat, 19 Oct 2024 16:37:33 +0200
> 
> Section 13.9 "Accessing Function Cell Contents" of the GNU Emacs Lisp
> Reference Manual emphasizes the distinction between void and nil
> in function cells:
> 
> |    Note that void is not the same as ‘nil’ or the symbol ‘void’.
> | The symbols ‘nil’ and ‘void’ are Lisp objects, and can be stored into
> | a function cell just as any other object can be (and ‘void’ can be a
> | valid function if you define it with ‘defun’).  A void function cell
> | contains no object whatsoever.
> 
> |    You can test the voidness of a symbol's function definition with
> | ‘fboundp’.  After you have given a symbol a function definition, you
> | can make it void once more using ‘fmakunbound’.
> 
> Also, for "fboundp":
> 
> |      This function returns ‘t’ if the symbol has an object in its
> |      function cell, ‘nil’ otherwise.  It does not check that the
> |      object is a legitimate function.
> 
> It seems that the actual behavior does not reflect this, i.e. there
> is no distinction between nil and void:
> 
>    (fmakunbound 'foo)
>    (fboundp 'foo) ⇒ nil
> 
>    (fset 'foo nil)
>    ;; according to the manual, the following should return t
>    ;; because nil is a Lisp object:
>    (fboundp 'foo) ⇒ nil
> 
> Is the manual wrong, or am I missing something?

I think the manual is wrong.  I think it tries to explain wrt void
functions the same it says about void variables, but we handle void
variables differently from void functions: void variables have a
distinct value in their value cell, whereas void functions have nil in
their function cell.

Stefan, am I right?





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

* bug#73886: 29.4; Confusing info about void function cells in Emacs Lisp manual
  2024-10-19 14:37 bug#73886: 29.4; Confusing info about void function cells in Emacs Lisp manual Ulrich Müller
  2024-10-19 17:45 ` Eli Zaretskii
@ 2024-10-19 19:08 ` Andreas Schwab
  2024-10-19 21:07   ` Ulrich Müller
  1 sibling, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2024-10-19 19:08 UTC (permalink / raw)
  To: Ulrich Müller; +Cc: 73886

On Okt 19 2024, Ulrich Müller wrote:

> Is the manual wrong, or am I missing something?

That changed in commit eadf1faa3cb, but the manual wasn't updated.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





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

* bug#73886: 29.4; Confusing info about void function cells in Emacs Lisp manual
  2024-10-19 19:08 ` Andreas Schwab
@ 2024-10-19 21:07   ` Ulrich Müller
  0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Müller @ 2024-10-19 21:07 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 73886

>>>>> On Sat, 19 Oct 2024, Andreas Schwab wrote:

> On Okt 19 2024, Ulrich Müller wrote:
>> Is the manual wrong, or am I missing something?

> That changed in commit eadf1faa3cb, but the manual wasn't updated.

Then the respective docstrings are also outdated, i.e. the term "void"
shouldn't occur in any of these:

   (fboundp SYMBOL)
   Return t if SYMBOL’s function definition is not void.

   (fmakunbound SYMBOL)
   Make SYMBOL’s function definition be void.
   Return SYMBOL.

   (symbol-function SYMBOL)
   Return SYMBOL’s function definition, or nil if that is void.





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

end of thread, other threads:[~2024-10-19 21:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-19 14:37 bug#73886: 29.4; Confusing info about void function cells in Emacs Lisp manual Ulrich Müller
2024-10-19 17:45 ` Eli Zaretskii
2024-10-19 19:08 ` Andreas Schwab
2024-10-19 21:07   ` Ulrich Müller

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