From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71934: 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 Message-ID: References: <87sewo5vym.fsf@web.de> <87zfqwh1gb.fsf@web.de> <86o77c75jd.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28308"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Michael Heerdegen , Eli Zaretskii , Andrea Corallo , 71934@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 05 22:27:07 2024 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 1sPpWN-00077A-MI for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Jul 2024 22:27:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPpWH-0001VE-TI; Fri, 05 Jul 2024 16:27:01 -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 1sPpWF-0001Sa-0f for bug-gnu-emacs@gnu.org; Fri, 05 Jul 2024 16:26:59 -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 1sPpWE-0001b2-Nc for bug-gnu-emacs@gnu.org; Fri, 05 Jul 2024 16:26:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sPpWH-0002Em-SF for bug-gnu-emacs@gnu.org; Fri, 05 Jul 2024 16:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Jul 2024 20:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71934 X-GNU-PR-Package: emacs Original-Received: via spool by 71934-submit@debbugs.gnu.org id=B71934.17202111768533 (code B ref 71934); Fri, 05 Jul 2024 20:27:01 +0000 Original-Received: (at 71934) by debbugs.gnu.org; 5 Jul 2024 20:26:16 +0000 Original-Received: from localhost ([127.0.0.1]:45086 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sPpVY-0002DZ-DO for submit@debbugs.gnu.org; Fri, 05 Jul 2024 16:26:16 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:54324) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sPpVW-0002DM-LL for 71934@debbugs.gnu.org; Fri, 05 Jul 2024 16:26:15 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id AB50D44465C; Fri, 5 Jul 2024 16:26:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1720211163; bh=3MrwPAhhyzi0T1PnoT6KLv+GsLgeAp/GFYLutIEm01g=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=lqXAHG6PG4SUdFIRsSQZJcir56BV8+mI1Iekj6iwd3VT+M72J7DpEq29xqBLYz+Mr PC6sRG/hOw32qCrmD3SmuETQz/KgtOORXrLJODw3eozKlvb+4Aaf5ewaEHEZhIbLe5 ieJd9e+lU+duM/MLEMsoxyG1t7ggE4WHluv/CcgKkxG7khIFiQxJBhbVPUIu2SZ14Z n7Q6rj8CMxiJYy6FaHPFAuiiIDgJ5zwol3OmJUqW7t8AKwdLNhnVL8EK9NEPOMfF/v 2z58JVK+oaZ1EK2hr8S7iUA2bYOu4t3iUYFf92Tfv1nZ576bo749VTXX8N7adgU+zU rfussam1pVasw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C8D97444654; Fri, 5 Jul 2024 16:26:03 -0400 (EDT) Original-Received: from pastel (unknown [45.72.245.253]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8DB3B120A19; Fri, 5 Jul 2024 16:26:03 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Fri, 5 Jul 2024 19:55:19 +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:288437 Archived-At: >> (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