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#54079: 29.0.50; Method dispatching eratically fails Date: Tue, 08 Mar 2022 16:03:12 -0500 Message-ID: References: <87mtik3l54.fsf@web.de> <87ilt6bgnt.fsf@web.de> <87sfsapgv0.fsf@web.de> <87o82ypfxz.fsf@web.de> <875youbhbu.fsf@web.de> <87k0d7257t.fsf@web.de> 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="38967"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Michael Heerdegen , Lars Ingebrigtsen , 54079@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 08 22:04:11 2022 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 1nRh07-0009tn-7G for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Mar 2022 22:04:11 +0100 Original-Received: from localhost ([::1]:53360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRh06-0001mW-4G for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Mar 2022 16:04:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRgzy-0001mI-Vh for bug-gnu-emacs@gnu.org; Tue, 08 Mar 2022 16:04:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35898) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nRgzy-0003xx-Gp for bug-gnu-emacs@gnu.org; Tue, 08 Mar 2022 16:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nRgzy-00074I-8Y for bug-gnu-emacs@gnu.org; Tue, 08 Mar 2022 16:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Mar 2022 21:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54079 X-GNU-PR-Package: emacs Original-Received: via spool by 54079-submit@debbugs.gnu.org id=B54079.164677340427120 (code B ref 54079); Tue, 08 Mar 2022 21:04:02 +0000 Original-Received: (at 54079) by debbugs.gnu.org; 8 Mar 2022 21:03:24 +0000 Original-Received: from localhost ([127.0.0.1]:58028 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nRgzM-00073L-7C for submit@debbugs.gnu.org; Tue, 08 Mar 2022 16:03:24 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:64998) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nRgzJ-000738-JJ for 54079@debbugs.gnu.org; Tue, 08 Mar 2022 16:03:22 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 1C78F1001CB; Tue, 8 Mar 2022 16:03:15 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A2333100120; Tue, 8 Mar 2022 16:03:13 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1646773393; bh=C0UMlKVrymdKlvY1AdKgPGT4KjguZZxzBbLcSzEpHUY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=dDkUdgaf3sbx6O9Iw6x0gRU8MBjz11+a0Caj3fp1/H3TPjrsnZ4U8tqxbkGamGGnE QVo/wOnNpy0JBFsrUj8f2KRAxtQyIDSww20wqi0wydSiGScXwc3Y+nRnVSJcyTx8Gz /KRdYOLk8O1gIOehccZF0BVgOZLeWX33wi+HiS1D3GytzzPaFD9bRSb14wYbmVuS/z p3H4yNBZSFkYWIxdObkqgZaLv+2I8kWDjADDSMhEzvUmVbLq+87XO5tdvmKu8pwaEo pZplbMpjoQo9BP+lw5Wk+i2ze6mSQiP+phNRhHyIlJgzy36z/uxmNfWodtSDd3xSLr X4exUbeNIXh9Q== Original-Received: from pastel (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6CBD312022E; Tue, 8 Mar 2022 16:03:13 -0500 (EST) In-Reply-To: (Alan Mackenzie's message of "Tue, 8 Mar 2022 20:48:23 +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" Xref: news.gmane.io gmane.emacs.bugs:228156 Archived-At: >> I'd expect the reverse: strip first and then eval the result. >> Why should we not strip the form passed to `byte-compile-eval`? > It's an edge case either way, but the form being evaluated might be a > `byte-compile', in which case it's (much) better to leave the positions > in place during this operation. I don't understand the scenario you're thinking of. Are you thinking of something like `(eval-when-compile (byte-compile ...))? Does that ever happen in real life? >> Does `byte-compile-top-level` already return a stripped form of code? > Compiled code is always stripped, at least since the weekend! OK, so no need to strip, go. >> And why bother stripping the result of `byte-compile-eval`? > Because it might be the result of evaluating a defun (or defvar or > defconst). AFAIK sympos should only appear within the compiler pipeline between the "read" and the "emit resulting bytecode". They may be passed to various functions and macros along the way, but I can't think of any scenario where they'd end up returned by `(byte-compile-)eval`. > This was the situation which gave rise to the bug. Could you give some details about how it played out? [ Either here or as a comment in the code. ] >> Fundamentally, `eval` should always strip before doing its job. > Except when what it's evaluating is a defun, defmacrro, defsubst, etc. Why? > Then it would be better to evaluate SWPs (which would work, since we're > inside a compilation, where enable-symbols-with-pos has been bound). > But here EXPANDED has been stripped before being evaluated, so I'm not > sure what you're saying here. I was suggesting to move the strip from the computation of `expanded` to the `eval` call. >> Yes, I know, it might be a bit expensive, but we should probably >> define a local function in `bytecomp.el` which does strip+eval and use >> that instead of `eval` (both here and in `byte-compile-eval`). WDYT? > I don't think stripping is really all that expensive. There are one or > two .el files in Emacs (ucs-normalize.el springs to mind) which have > very large lists with vectors in them, yet they don't seem noticeably to > slow down the Emacs build. So maybe we should redefine `eval` as "strip and then eval"? Stefan