GNU bug report logs - #73886
29.4; Confusing info about void function cells in Emacs Lisp manual

Previous Next

Package: emacs;

Reported by: Ulrich Müller <ulm <at> gentoo.org>

Date: Sat, 19 Oct 2024 14:39:01 UTC

Severity: normal

Found in version 29.4

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Ulrich Müller <ulm <at> gentoo.org>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 73886 <at> debbugs.gnu.org
Subject: bug#73886: 29.4; Confusing info about void function cells in Emacs Lisp manual
Date: Sat, 19 Oct 2024 20:45:55 +0300
> From: Ulrich Müller <ulm <at> 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?




This bug report was last modified 262 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.