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#70368: [PATCH] Use a dedicated type to represent interpreted-function values Date: Mon, 15 Apr 2024 08:22:10 -0400 Message-ID: References: <86il0ko6f9.fsf@gnu.org> <86h6g4m29n.fsf@gnu.org> <86sezmlvht.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="425"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 70368@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 15 14:23:16 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 1rwLMh-000ASW-RQ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Apr 2024 14:23:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rwLMN-00062N-LA; Mon, 15 Apr 2024 08:22:55 -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 1rwLML-00061s-R8 for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 08:22:53 -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 1rwLML-0005Hf-In for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 08:22:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rwLMW-0004yo-Df for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 08:23:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Apr 2024 12:23:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70368 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 70368-submit@debbugs.gnu.org id=B70368.171318375318875 (code B ref 70368); Mon, 15 Apr 2024 12:23:04 +0000 Original-Received: (at 70368) by debbugs.gnu.org; 15 Apr 2024 12:22:33 +0000 Original-Received: from localhost ([127.0.0.1]:37069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwLLz-0004uB-Cv for submit@debbugs.gnu.org; Mon, 15 Apr 2024 08:22:32 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:59656) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwLLx-0004sx-5X for 70368@debbugs.gnu.org; Mon, 15 Apr 2024 08:22:29 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 18B0C80C41; Mon, 15 Apr 2024 08:22:12 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1713183731; bh=4ZVvw+W+l+yyTrHijn635zWVr64sOrzX7YUZDHiX2io=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=eikG+I6zihyLoqyTm3zlfBIqpLFDjqhv++awbfpGyXzESPK4NVsp6JLtMmlhVta38 JxufQhamvh49ZrJ8bT+Ot482hzp0Yd4ZV3I1dGgesFXMCRS6r12PAFIMcqOtAPTDMd dGKZHBJ3v17flDx+hAC2/NNG/pv90hoFC3A9qxecQLUnHyMm3d44pOrEj36gXflIDS itIx9TN5MevtgjoFShvF48DKMQndfHJNgTwmrQ/lh15a2v66wF+PglcpAYtts6gIzY MD+mBEkKRB5nQzPVYdl8oKPsSIq0kF0tgmRBojOmgDYjmdMlLwzu8+SLbgcwzhLUkw Xhf4QdrSrjDEQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id F02DF80AD9; Mon, 15 Apr 2024 08:22:10 -0400 (EDT) Original-Received: from pastel (unknown [45.72.201.215]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D06901202A2; Mon, 15 Apr 2024 08:22:10 -0400 (EDT) In-Reply-To: <86sezmlvht.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 15 Apr 2024 14:23:58 +0300") 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:283367 Archived-At: > I think the only problems we need to mention are those with Lisp > programs that "dig" inside the code of functions. I think it should > be enough to give one or two concrete examples (what internals the > offending code depended on), and tell that these techniques will no > longer work. You mention above examples of packages that used to do > it, but that's not useful; providing specific examples of what those > packages did will explain the problems much better. There's nothing very special about it: `car/cdr` on an interpreted function will fail because it's not represented as a list any more. You can still extract the various subparts with `aref`, tho. >> How do you imagine a user or developer is going to make use of the >> above info? > They will realize which techniques are no longer supposed to work, and > could look into their code to try find such techniques. The "techniques" that won't work any more are any and all accesses to a function via `car/cdr` (and derivatives, like `assq`), but that should be immediately obvious from: Instead of representing interpreted functions as lists that start with either 'lambda' or 'closure', Emacs now represents them as objects of their own 'interpreted-function' type, which is very similar to 'byte-code-function' objects (the argument list, docstring, and interactive forms are placed in the same slots). >> > I think this also calls for augmenting the documentation of >> > make-byte-code to the effect that it could now create closures as >> > well. >> >> I'm not very happy documenting it, because I think it's an >> implementation accident resulting from the historical evolution of >> the code. IOW something we may want to fix. > > Then maybe a defalias with a suitable name could be the first step in > that direction? > > I suggested documenting it because the name of the function no longer > describes accurately what it does, and people might be surprised to > see that it is used to create something other than byte-code. Hmm... I'll see what I can come up with, Stefan