GNU bug report logs -
#71934
31.0.50; edebug--called-interactively-skip vs. new fun objects
Previous Next
Full log
Message #34 received at 71934 <at> debbugs.gnu.org (full text, mbox):
> Not sure what you mean by "no such thing as a form ... like a closure".
A form that starts with `closure` is not a valid form because there is
no definition for `closure`: (fboundp 'closure) => nil.
> I bumped into one last summer.
>
> In particular (in my development repo fixing bug #64646) I put this into
> *scratch*:
>
> (defconst foo (lambda (baz) (car baz)))
>
> , evaluated it with C-x C-e and then M-: (native-compile foo). This
> threw the error "Cannot native-compile, form is not a lambda".
That error seems right according to the docstring:
(defun native-compile (function-or-file &optional output)
"Compile FUNCTION-OR-FILE into native code.
This is the synchronous entry-point for the Emacs Lisp native
compiler. FUNCTION-OR-FILE is a function symbol, a form, or the
filename of an Emacs Lisp source file. If OUTPUT is non-nil, use
it as the filename for the compiled object. If FUNCTION-OR-FILE
is a filename, if the compilation was successful return the
filename of the compiled object. If FUNCTION-OR-FILE is a
function symbol or a form, if the compilation was successful
return the compiled function."
(closure ...) is not a function symbol nor a valid form. Instead it's
a function value and the docstring doesn't say such are
a valid arguments to `native-compile`.
Admittedly, maybe we should extend `native-compile` to accept function
values, just like `byte-compile`.
> The value of foo had been turned into a form (closure ....).
No, "form" is a specific term which denotes a piece of source code (I
usually used the term "expression" for that, but IIUC in the Lisp world
the more common term for that is "form").
(closure ....) is not a *form* code any more than (1 foo) or (+ . 4)
[ except to the extent that we *could* make it into a valid form by
providing a definition for `closure` (as a macro, function, or
special form). ]
> So I fixed
> comp--spill-lap-function (form version) so as to compile that form.
Why `comp--spill-lap-function` specifically (instead of
`native-compile`, for example)?
> I've no idea how Emacs would handle that defconst now.
Hmm... AFAICT your example doesn't relate to `defconst`.
You'd get the same result with
M-: (native-compile (lambda (baz) (car baz))) RET
- Stefan
This bug report was last modified 314 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.