GNU bug report logs -
#69832
30.0.50; Should `subr-primitive-p` apply to special-forms?
Previous Next
Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>
Date: Sat, 16 Mar 2024 19:32:01 UTC
Severity: normal
Found in version 30.0.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 69832 <at> debbugs.gnu.org (full text, mbox):
> Cc: monnier <at> iro.umontreal.ca
> Date: Sat, 16 Mar 2024 15:30:01 -0400
> From: Stefan Monnier via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> Currently (subr-primitive-p (symbol-function 'if)) returns t.
> Its docstring disagrees:
>
> Return t if OBJECT is a built-in primitive function.
>
> because `if` is indeed a "built-in primitive" but not a "function" (you
> can't `funcall` it and it is rejected by `functionp`: it's a special
> form instead).
>
> For ELisp's type hierarchy/DAG we need a type for "a built-in primitive
> which is also a function". Originally, based on the docstring,
> I thought I could use `subr-primitive`.
> But it turns out that the code doesn't quite match the docstring.
>
> I can see two ways to fix that:
>
> - Introduce a new type, says `subr-function(-p)` which returns non-nil
> if and only if the argument is a built-in primitive *and* a function.
>
> - Change the implementation of `subr-primitive-p` to match its docstring.
>
> The patch below does the second (including changing the only place
> I found that wants the current semantics.
>
> Comments? Objections?
Why take the path of a breaking change instead of the non-breaking
alternative?
This bug report was last modified 1 year and 63 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.