GNU bug report logs - #71934
31.0.50; edebug--called-interactively-skip vs. new fun objects

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Thu, 4 Jul 2024 05:12:02 UTC

Severity: normal

Found in version 31.0.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #40 received at 71934 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, Eli Zaretskii <eliz <at> gnu.org>,
 Andrea Corallo <acorallo <at> gnu.org>, 71934 <at> debbugs.gnu.org
Subject: Re: comp--spill-lap-function and closure (wad: bug#71934: 31.0.50;
 edebug--called-interactively-skip vs. new fun objects)
Date: Fri, 05 Jul 2024 16:26:02 -0400
>> (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.

To obey the docstring, if you want to compile a function whose value is
stored in the variable `foo` you can do:

    (let ((sym (gensym)))
      (fset sym foo)
      (native-compile sym))

It's admittedly not the most convenient, which is why `byte-compile`
(in contrast to `native-compile`) accepts function values in addition to
forms and function symbols.

> I've just tried it on emacs-30, and it doesn't work.

As it is allowed to, according to its docstring.

> But you could compile foo last summer after my fixes for bug #64646.

[ But that still failed to make it work for byte-compiled function values,
  and it failed to update the docstring to announce that new behavior.  ]

>> Admittedly, maybe we should extend `native-compile` to accept function
>> values, just like `byte-compile`.
> Or something like that, yes.  But if logical combinations of terms like
> "form", "closure", "function value", "valid form" lead to not being able
> to compile foo, then I suggest that these terms and their applicability
> might need to be thought through somewhat.

Don't worry: they've been thought through aplenty.

>>> 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 fixed what was wrong at the time.

I'd like to implement the feature of `native-compile` accepting function
values correctly rather than in the most expedient way.  If you could
try to remember why you fixed it in this specific way, that would be
very helpful, because I'm not sufficiently familiar with the code of
`comp--spill-lap-function` to be sure of what I'm doing.

>> > 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
> Whatever.  foo doesn't compile; that should be fixed.

All I'm saying is that it's a feature request, rather than a bug to
be fixed.


        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.