GNU bug report logs - #62746
[PATCH] Updated Elispref-Manual: `nil' cannot be defuned

Previous Next

Package: emacs;

Reported by: Shynur Xie <one.last.kiss <at> outlook.com>

Date: Mon, 10 Apr 2023 08:39:01 UTC

Severity: normal

Tags: patch

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: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 62746 <at> debbugs.gnu.org, Shynur Xie <one.last.kiss <at> outlook.com>
Subject: bug#62746: [PATCH] Updated Elispref-Manual: `nil' cannot be defuned
Date: Mon, 10 Apr 2023 10:14:59 -0400
>> “The symbols nil and void are Lisp objects, and can be stored into a
>>  function cell just as any other object can be (and they can be valid
>>  functions if you define them in turn with defun).”
>> 
>> Updated:
>> 
>> “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).”
>
> Why do you think the original text needs to be corrected?

Indeed, `nil` is treated specially to mean "not defined" when we try to
call a function:

    Lisp_Object
    funcall_general (Lisp_Object fun, ptrdiff_t numargs, Lisp_Object *args)
    {
      Lisp_Object original_fun = fun;
     retry:
      if (SYMBOLP (fun) && !NILP (fun)
          && (fun = XSYMBOL (fun)->u.s.function, SYMBOLP (fun)))
        fun = indirect_function (fun);
    
      if (SUBRP (fun) && !SUBR_NATIVE_COMPILED_DYNP (fun))
        return funcall_subr (XSUBR (fun), numargs, args);
      else if (COMPILEDP (fun)
               || SUBR_NATIVE_COMPILED_DYNP (fun)
               || MODULE_FUNCTIONP (fun))
        return funcall_lambda (fun, numargs, args);
      else
        {
          if (NILP (fun))
            xsignal1 (Qvoid_function, original_fun);


-- Stefan





This bug report was last modified 2 years and 109 days ago.

Previous Next


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