GNU bug report logs -
#36392
(info "(elisp)Writing Emacs Primitives") might need some clarifications
Previous Next
Reported by: Stefan Kangas <stefan <at> marxist.se>
Date: Wed, 26 Jun 2019 11:32:01 UTC
Severity: minor
Tags: fixed, patch
Fixed in version 26.3
Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 36392 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tags 36392 + patch
severity 36392 minor
quit
[0001-Clarify-update-elisp-Writing-Emacs-Primitives.patch (text/x-diff, attachment)]
[Message part 3 (text/plain, inline)]
Stefan Kangas <stefan <at> marxist.se> writes:
> As a beginner on Emacs Internals, I've been reading:
>
> (info "(elisp)Writing Emacs Primitives")
>
> I hope that you find the following observations useful:
>
> 1. "If the primitive accepts a fixed maximum number of Lisp
> arguments, there must be one C argument for each Lisp argument,
> and each argument must be of type ‘Lisp_Object’. ... If the
> primitive has no upper limit on the number of Lisp arguments, it
> must have exactly two C arguments: the first is the number of Lisp
> arguments, and the second is the address of a block containing
> their values."
>
> The example given is DEFUN( "or", ...)
>
> This function has no upper limit on the number of Lisp arguments, but
> still has only ONE argument. Unless I'm missing something, this
> contradicts the statement above that "it must have exactly TWO C
> arguments" (my emphasis).
Indeed, this is because For is a special form (with UNEVALLED args).
Compare it with the definition for Fapply (with MANY args) in the same
file, and see the macros DEFUN_ARGS_UNEVALLED and DEFUN_ARGS_MANY in
lisp.h.
Does the attached patch, suitable for either master or emacs-26, help
clarify this?
> 2. "Although the garbage collector does not reclaim objects reachable
> from C ‘Lisp_Object’ stack variables, it may move non-object
> components of an object, such as string contents; so functions
> that access non-object components must take care to refetch their
> addresses after performing Lisp evaluation."
>
> I don't think this is very clear. What is non-object components? How
> would I refetch their addresses? How is this relevant to the topic at
> hand?
I don't know about this.
Thanks,
--
Basil
This bug report was last modified 5 years and 330 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.