1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-04 22:50:59 -08:00
emacs/doc
Stefan Monnier 80ba4c1707 eval.c: New functions defvar-1 and defconst-1 (bug#55156)
The bytecode interpreter can't directly call special forms, so
the byte-compiler usually converts special forms into some sequence of
byte codes (basically, providing a duplicate definition of the special
form).  There are still two exceptions to this: `defconst` and `defvar`,
where the compiler instead generates a convoluted chunk of code like:

    (funcall '(lambda (x) (defvar <sym> x <doc>)) <value>)

where the quote makes sure we keep the function non-compiled, so as
to end up running the special form at run time.

Get rid of this workaround by introducing `defvar-1` and `defconst-1`
which provide a *functional* interface to the functionality of the
corresponding special form.

* src/eval.c (defvar, Fdefvar_1, Fdefconst_1): New functions, extracted from
`Fdefvar` and `Fdefconst`.
(Fdefvar, Fdefconst): Use them.
(syms_of_eval): `defsubr` the new functions.

* lisp/emacs-lisp/bytecomp.el (byte-compile-tmp-var): Delete const.
(byte-compile-defvar): Simplify using the new functions.

* doc/lispref/variables.texi (Defining Variables): Adjust the doc of
`defvar` to reflect the actual semantics implemented.
2022-05-26 12:21:32 -04:00
..
emacs Merge from origin/emacs-28 2022-05-25 13:57:59 -04:00
lispintro Change current-time back to list form 2022-04-28 12:54:06 -07:00
lispref eval.c: New functions defvar-1 and defconst-1 (bug#55156) 2022-05-26 12:21:32 -04:00
man Merge from origin/emacs-28 2022-01-01 07:03:03 -05:00
misc Merge from origin/emacs-28 2022-05-25 13:57:59 -04:00