From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: bug#64646: Master: Native compiler doesn't always compile lambda forms. Date: Wed, 26 Jul 2023 10:57:01 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11740"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64646@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 26 19:54:40 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qOiid-0002oX-5z for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Jul 2023 19:54:39 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOiDW-0000pk-VI; Wed, 26 Jul 2023 13:22:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOfxi-0005Zz-65 for bug-gnu-emacs@gnu.org; Wed, 26 Jul 2023 10:58:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qOfxh-0002aS-Uu for bug-gnu-emacs@gnu.org; Wed, 26 Jul 2023 10:58:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qOfxh-0002wX-PJ for bug-gnu-emacs@gnu.org; Wed, 26 Jul 2023 10:58:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Jul 2023 14:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64646 X-GNU-PR-Package: emacs Original-Received: via spool by 64646-submit@debbugs.gnu.org id=B64646.169038344811246 (code B ref 64646); Wed, 26 Jul 2023 14:58:01 +0000 Original-Received: (at 64646) by debbugs.gnu.org; 26 Jul 2023 14:57:28 +0000 Original-Received: from localhost ([127.0.0.1]:49818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qOfxA-0002vK-1d for submit@debbugs.gnu.org; Wed, 26 Jul 2023 10:57:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48588) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qOfx7-0002v0-TL for 64646@debbugs.gnu.org; Wed, 26 Jul 2023 10:57:26 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOfx2-0002WJ-7v; Wed, 26 Jul 2023 10:57:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=a32SVjWFP4Dd9eD0P92NscHJkHmBpa4nY+pm9kOB5Ho=; b=qnmbhFQCUYMbjoEgBzQa YY0FtGLLPTUWe6WDjlbdGL+evRwHgAYgQvkdmmgu9k/LrZUrZajnHTho5GDjO901wXWrR13qzQXV4 sUMvddPn18zEwbtcP55i+GCiIt50HpIQeu7yPsueMOWrdPgLNQ++oDPrTfFzKLqOPpKWpDGlT7OaK VOAHj2FPmIHa72fudbhx9FqeLDhx08hsHOPCupUHpJnPBJBVgnr2agUncNn/Vj5tDGPqVXd9Ugc2/ Od2Ll0xrGgftmg2Ffvkc4uSyzyg/UdCfGLcB8B4iu+BbH/bCJY5mUVQDMZOWp2usCMYbhuLamGlaf 3yduruecz4D4Lg==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1qOfwm-0001zp-1S; Wed, 26 Jul 2023 10:57:19 -0400 In-Reply-To: (Alan Mackenzie's message of "Thu, 20 Jul 2023 12:14:31 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:266118 Archived-At: Alan Mackenzie writes: > Hello, Andrea. > > On Mon, Jul 17, 2023 at 09:17:13 -0400, Andrea Corallo wrote: >> Alan Mackenzie writes: > >> > In the master branch: > >> > (i) emacs -Q >> > (ii) C-x b foo.el >> > (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 # >> > (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? Hi Alan, I'm not saying it would be incorrect. I'm suggesting that if is not specified what's the expected behaviour of compiling by name the outer lambda it might not be a bug. When we compile a whole compilation unit we indeed have to compile all functions, in this case what we promised is I think not defined. Andrea