GNU bug report logs -
#73886
29.4; Confusing info about void function cells in Emacs Lisp manual
Previous Next
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
Message #23 received at 73886 <at> debbugs.gnu.org (full text, mbox):
>> Oops. Looks like I missed this part when I changed it back around
>> Emacs-24.4:
>>
>> ** In 'symbol-function', nil and "unbound" are indistinguishable.
>> 'symbol-function' does not signal a 'void-function' error any more.
>> To determine if a symbol's function definition is void, use 'fboundp'.
>
> Could you explain the rationale for that change? I tried to look for
> relevant discussions around that date, but came up empty-handed.
I can't remember discussing it, no. It was a kind of "executive
decision".
Having a special "void" (`Qundefined`) non-value for the `symbol-value`
is needed for `boundp` since variables can contain *any* value, but not
for the `symbol-function` part where we can use any normal value (I
chose `nil`) to play this role as long as it doesn't collide with values
normally held in the `symbol-function` slot, like function names,
function values, cons cells, vectors, ...
The upside was a simplification in various chunks of code which used to
do things like `(and (fboundp SYM) (symbol-function SYM))` which can now
be simplified to `(symbol-function SYM)`.
I remember two "motivators", i.e. places where the need to pay attention
to the special void case annoyed me enough to look into this and make
the change, one was `nadvice.el` and the other was `cl-letf`.
[ So, it was no accident that the change happened in the same release as
the addition of `nadvice.el`. ]
In both cases the issue is that we want to deal with "places"
(generalized variables) and that abstraction works well for those places
which *always* contain a value, but not as well for those special places
that can be "unbound", so removing the "unbound" case from
`symbol-function` resulted in a welcome simplification.
For the same reason I dislike EIEIO's notion of `slot-boundp` and have
already considered marking it obsolete.
Stefan
This bug report was last modified 261 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.