From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#54079: 29.0.50; Method dispatching eratically fails Date: Wed, 9 Mar 2022 17:42:56 +0000 Message-ID: References: <87ilt6bgnt.fsf@web.de> <87sfsapgv0.fsf@web.de> <87o82ypfxz.fsf@web.de> <875youbhbu.fsf@web.de> <87k0d7257t.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6671"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Michael Heerdegen , Lars Ingebrigtsen , 54079@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 09 18:44:25 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 1nS0ML-0001Zw-Jx for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Mar 2022 18:44:25 +0100 Original-Received: from localhost ([::1]:32958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nS0MK-0004co-CB for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 09 Mar 2022 12:44:24 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:56188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nS0Ly-0003wF-0C for bug-gnu-emacs@gnu.org; Wed, 09 Mar 2022 12:44:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38542) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nS0Lx-0007p7-My for bug-gnu-emacs@gnu.org; Wed, 09 Mar 2022 12:44:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nS0Lx-0003ja-KM for bug-gnu-emacs@gnu.org; Wed, 09 Mar 2022 12:44:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Mar 2022 17:44:01 +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.164684778614273 (code B ref 54079); Wed, 09 Mar 2022 17:44:01 +0000 Original-Received: (at 54079) by debbugs.gnu.org; 9 Mar 2022 17:43:06 +0000 Original-Received: from localhost ([127.0.0.1]:60672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nS0L4-0003i9-Dt for submit@debbugs.gnu.org; Wed, 09 Mar 2022 12:43:06 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:40455 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1nS0L2-0003hT-0b for 54079@debbugs.gnu.org; Wed, 09 Mar 2022 12:43:04 -0500 Original-Received: (qmail 2165 invoked by uid 3782); 9 Mar 2022 17:42:57 -0000 Original-Received: from acm.muc.de (p4fe15624.dip0.t-ipconnect.de [79.225.86.36]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 09 Mar 2022 18:42:56 +0100 Original-Received: (qmail 5677 invoked by uid 1000); 9 Mar 2022 17:42:56 -0000 Content-Disposition: inline In-Reply-To: X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de 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:228172 Archived-At: Hello, Stefan. On Tue, Mar 08, 2022 at 16:03:12 -0500, Stefan Monnier wrote: > >> 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 ...))? Yes. > Does that ever happen in real life? Probably exceedingly seldomly. What's to be gained by not catering to this unusual case? What do we lose? > >> 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. ] Michael byte compiled cl-generic.el. This created cl-generic.elc correctly, but also left uncompiled forms in the function cells of the symbols defun'd inside an eval-{when,and}-compile. These forms contained symbols with positions. > >> Fundamentally, `eval` should always strip before doing its job. > > Except when what it's evaluating is a defun, defmacrro, defsubst, etc. > Why? Because that evaluated form might later be byte compiled, and the SWPs will be needed for that. > > 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"? Isn't `eval' already complicated enough, with lexical-binding as an argument? Stripping SWPs is not a part of evaluation. It is something else. eval should "do one thing and do it well". > Stefan -- Alan Mackenzie (Nuremberg, Germany).