GNU bug report logs - #64646
Master: Native compiler doesn't always compile lambda forms.

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Sat, 15 Jul 2023 12:11:02 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Andrea Corallo <acorallo <at> gnu.org>
Cc: 64646 <at> debbugs.gnu.org
Subject: bug#64646: Master: Native compiler doesn't always compile lambda forms.
Date: Thu, 20 Jul 2023 12:14:31 +0000
Hello, Andrea.

On Mon, Jul 17, 2023 at 09:17:13 -0400, Andrea Corallo wrote:
> Alan Mackenzie <acm <at> muc.de> writes:

> > In the master branch:

> > (i) emacs -Q
> > (ii) C-x b foo.el <RET>
> > (iii) Insert into foo.el:
> >     ;; -*- lexical-binding:t -*-
> > (iv) M-x emacs-lisp-mode
> > (v) Insert into foo.el:
> >     (defun foo () "foo doc string"
> >       (lambda (bar) "lambda doc string" (car bar)))
> > (vi) With point after the function, C-x C-e to evaluate it.

> > (vii) M-: (native-compile 'foo)
> > This returns #<subr foo>
> > (viii) M-: (foo)
> > This returns the lambda form as a byte-compiled function.  This is a bug:
> > it should return the lambda form as a native-compiled function.

> > Note: this bug is also in the emacs-29 branch.

> Hi Alan,

> I can reproduce, (native-compile 'foo) compiles only foo, compiling the
> whole compilation unit with eg `emacs-lisp-native-compile-and-load'
> compiles as expected also the inner lambda.

Why would compiling a .el file compile inner lambda forms, but
native-compile doesn't?

> I'm not 100% convinced this behaviour is a bug tho.

I don't understand that.  Why might it be incorrect to compile that inner
lambda natively?

>   Andrea

-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 1 year and 274 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.