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 14:17:38 -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="4369"; 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 20:18:22 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 1sPnVl-0000ur-In for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 Jul 2024 20:18:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPnVS-0005YR-5r; Fri, 05 Jul 2024 14:18:02 -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 1sPnVP-0005Y0-OO for bug-gnu-emacs@gnu.org; Fri, 05 Jul 2024 14:17: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 1sPnVP-0001ZG-GI for bug-gnu-emacs@gnu.org; Fri, 05 Jul 2024 14:17:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sPnVS-0006iD-Hk for bug-gnu-emacs@gnu.org; Fri, 05 Jul 2024 14:18:02 -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 18:18:02 +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.172020346125770 (code B ref 71934); Fri, 05 Jul 2024 18:18:02 +0000 Original-Received: (at 71934) by debbugs.gnu.org; 5 Jul 2024 18:17:41 +0000 Original-Received: from localhost ([127.0.0.1]:44965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sPnV7-0006ha-6D for submit@debbugs.gnu.org; Fri, 05 Jul 2024 14:17:41 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:43913) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sPnV5-0006hJ-8Z for 71934@debbugs.gnu.org; Fri, 05 Jul 2024 14:17:39 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9C2CC441F72; Fri, 5 Jul 2024 14:17:29 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1720203447; bh=wtjboy2EbOht+UuMUI9DRA1O3TN35Bsinn3soH62szs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=jF6caI26VbwnTzx4tmAmh8uCoJTyAuV6Ff27JpXqyDrQUusRvn76MO1IAQEXUKavR T9R2SmkeaLjC7YKrf6ctgyFfVA9OJ6ggFVz/fZTUM0pk9yRiLt9Z742iCFt6+dr05G dL4UUmGz53AHwxwIY7HB6zPdtBh2RnI2u/osyDKmwUYQ+g7tzYchcxahVYE8Q1k733 WpEfOK8p2zguBf5MIJoNIgVu3XeolYVjRbvEhQD+hrvnTFt6eVwgkDLqH7uD3hCIaC HSYWhbfc2OHX1zJurbFVJA9gmJZM3zSLfkrGgdf/otBYm67rtCf7Z0PBM7Ie6tSI7R wiHy8NH/2ZnjA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id CC64944235C; Fri, 5 Jul 2024 14:17:27 -0400 (EDT) Original-Received: from alfajor (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A20C9120796; Fri, 5 Jul 2024 14:17:27 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Fri, 5 Jul 2024 16:48:21 +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:288431 Archived-At: > 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`. Admittedly, maybe we should extend `native-compile` to accept function values, just like `byte-compile`. > The value of foo had been turned into a form (closure ....). No, "form" is a specific term which denotes a piece of source code (I usually used the term "expression" for that, but IIUC in the Lisp world the more common term for that is "form"). (closure ....) is not a *form* code any more than (1 foo) or (+ . 4) [ except to the extent that we *could* make it into a valid form by providing a definition for `closure` (as a macro, function, or special form). ] > 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'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 - Stefan