all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andrea Corallo <acorallo@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
	Eli Zaretskii <eliz@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	71934@debbugs.gnu.org
Subject: bug#71934: comp--spill-lap-function and closure (wad: bug#71934: 31.0.50; edebug--called-interactively-skip vs. new fun objects)
Date: Sat, 06 Jul 2024 13:29:01 -0400	[thread overview]
Message-ID: <yp1cynqh1k2.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <ZokkDv-tWbLuIFDh@ACM> (Alan Mackenzie's message of "Sat, 6 Jul 2024 11:01:34 +0000")

Alan Mackenzie <acm@muc.de> writes:

> Hello, Andrea.
>
> On Sat, Jul 06, 2024 at 03:48:50 -0400, Andrea Corallo wrote:
>> Alan Mackenzie <acm@muc.de> writes:
>
>> > Hello, Stefan.
>
>> > On Fri, Jul 05, 2024 at 14:17:38 -0400, Stefan Monnier wrote:
>> >> > 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`.
>
>> > All very clever arguments, no doubt, but in the end it means you cannot
>> > native compile foo.  I've just tried it on emacs-30, and it doesn't work.
>> > But you could compile foo last summer after my fixes for bug #64646.
>> > Between last summer and now, something has gone badly wrong in Emacs's
>> > basic mechanisms.
>
>> (defconst foo (lambda (baz) (car baz)))
>> (native-compile #'foo)
>
>> Never worked AFAIR, ....
>
> No.  But (native-compile foo) did work.  It compiled the value of foo,
> producing an anonymous subr.
>
>> ....the functionality you added was:
>
>> (defun foo () "foo doc string"
>>        (lambda () "lambda doc string" 3))
>
>> (subr-native-elisp-p (funcall (native-compile 'foo)))
>
> Yes.
>
>> And this still works for me.
>
> It still works for me, too.
>
>> I'm probably missing something sorry.
>
> The fact that
>
> 	(defconst foo (lambda (baz) (car baz)))
> 	(native-compile foo)
>
> worked (as of 2023-11-08), but no longer does.  It was not the main topic
> of bug #64646 (for which see above), but was fixed in the commit for that
> bug anyway.  This was possibly not a good idea.  That commit was:
>
> commit 06e4ebc81a44c709b08ce72c746629c6c77e6f6e
> Author: Alan Mackenzie <acm@muc.de>
> Date:   Wed Nov 8 20:49:48 2023 +0000
>
>     With `native-compile', compile lambdas in a defun or lambda too

Thanks I see now, at least we never regressed over releases.

I think this functionaly passed under my radar at the time, otherwise I
would have asked for a test covering it, and BTW as a consequence Stefan
would have updated the implementation before upstreaming his patch :)

Anyway as
(defconst foo (lambda (baz) (car baz)))
(byte-compile foo)
works, I is nice to have it functional for native-comp as well.

Reintroducing it should not be too difficult, I can do it myself next
week if no-one does it before.

Thanks

  Andrea





  reply	other threads:[~2024-07-06 17:29 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-04  5:11 bug#71934: 31.0.50; edebug--called-interactively-skip vs. new fun objects Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-04 13:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-04 15:47   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-05  4:00     ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-05  4:24       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-05  5:06         ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-05  5:48           ` Eli Zaretskii
2024-07-05  8:46             ` Andrea Corallo
     [not found]               ` <jwvtth4c7f3.fsf-monnier+emacs@gnu.org>
     [not found]                 ` <Zof2edaqLQfHD4_B@ACM>
     [not found]                   ` <jwvbk3b970b.fsf-monnier+emacs@gnu.org>
2024-07-05 16:48                     ` bug#71934: comp--spill-lap-function and closure (wad: bug#71934: 31.0.50; edebug--called-interactively-skip vs. new fun objects) Alan Mackenzie
2024-07-05 18:17                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-05 19:55                         ` Alan Mackenzie
2024-07-05 20:26                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-05 21:41                             ` Alan Mackenzie
2024-07-06  1:06                               ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-06  6:36                                 ` Eli Zaretskii
2024-07-06  8:06                                   ` Andrea Corallo
2024-07-06 14:27                                 ` Alan Mackenzie
2024-07-08  1:35                                   ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-08  2:32                                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-08  8:47                                       ` Andrea Corallo
2024-07-08 10:18                                     ` Alan Mackenzie
2024-07-09  5:19                                       ` bug#71934: 31.0.50; edebug--called-interactively-skip vs. new fun objects Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-06  7:48                           ` bug#71934: comp--spill-lap-function and closure (wad: bug#71934: 31.0.50; edebug--called-interactively-skip vs. new fun objects) Andrea Corallo
2024-07-06 11:01                             ` Alan Mackenzie
2024-07-06 17:29                               ` Andrea Corallo [this message]
2024-07-09 20:49                                 ` Andrea Corallo
2024-07-10 10:29                                   ` Alan Mackenzie
2024-07-10 11:28                                     ` Andrea Corallo
2024-07-06  7:33                       ` Andrea Corallo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yp1cynqh1k2.fsf@fencepost.gnu.org \
    --to=acorallo@gnu.org \
    --cc=71934@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.