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#65017: 29.1; Byte compiler interaction with cl-lib function objects, removes symbol-function Date: Thu, 10 Aug 2023 14:50:03 +0000 Message-ID: References: <8B08E514-B2D5-48F5-BA90-4F5A9492F8F9@gmail.com> 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="8874"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 65017@debbugs.gnu.org, Eric Marsden To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 10 16:51:13 2023 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 1qU70K-0002Bc-RM for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Aug 2023 16:51:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qU70B-0001sl-WA; Thu, 10 Aug 2023 10:51:04 -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 1qU70A-0001sG-9k for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2023 10:51:02 -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 1qU70A-0002f2-29 for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2023 10:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qU709-00073w-UX for bug-gnu-emacs@gnu.org; Thu, 10 Aug 2023 10:51:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Aug 2023 14:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65017 X-GNU-PR-Package: emacs Original-Received: via spool by 65017-submit@debbugs.gnu.org id=B65017.169167901527084 (code B ref 65017); Thu, 10 Aug 2023 14:51:01 +0000 Original-Received: (at 65017) by debbugs.gnu.org; 10 Aug 2023 14:50:15 +0000 Original-Received: from localhost ([127.0.0.1]:43818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qU6zP-00072l-20 for submit@debbugs.gnu.org; Thu, 10 Aug 2023 10:50:15 -0400 Original-Received: from mx3.muc.de ([193.149.48.5]:27702) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qU6zK-00072P-VN for 65017@debbugs.gnu.org; Thu, 10 Aug 2023 10:50:13 -0400 Original-Received: (qmail 2114 invoked by uid 3782); 10 Aug 2023 16:50:04 +0200 Original-Received: from acm.muc.de (pd953a568.dip0.t-ipconnect.de [217.83.165.104]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 10 Aug 2023 16:50:03 +0200 Original-Received: (qmail 5309 invoked by uid 1000); 10 Aug 2023 14:50:03 -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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:267140 Archived-At: Hello, Stefan. On Wed, Aug 09, 2023 at 23:41:56 -0400, Stefan Monnier wrote: > >> > Are you sure? > >> Yes. > > What about two SWPs with the same symbol but different positions? If > > they aren't considered EQ here, there will never be a match for the > > first arm of the cond form in cl--labels-convert; then > > cl--labels-convert-cache will get written, but never used. > Nope: when it gets written, the `function` macro returns: > (function ) > so the macro is immediately called again with the *exact* same > , so the second time the `function` macro is called, the > cache does hit (and it's the only case where it should hit), making the > second call to the macro return the *exact* `eq`-same > (function ) > list which is the trick that stops the infinite macroexpansion loop. OK, thanks, I think I've got that now. > Next time the `function` macro is invoked with a "similar" sympos the > cache should *not* match because we don't want to accidentally replace > (function ) > with > (function ) > > And if, somehow, it does get used (the current code, I think), then (as > > you write below) the argument F will get replaced by an F with the wrong > > position. Am I right, here? > That's right. OK. So perhaps binding symbols-with-pos-enabled to nil around that eq call could be the way to go. > > Why must the F get replaced by a different F? There must surely be a > > way, a simpler way than the current cl--labels-convert, to retain the > > current F (hence, not corrupting its position)? > There might. The current hack is the best I could come up with. I'm not criticising the hack, not at all! But it could be better commented, and the doc string for cl--labels-convert could be more informative. The "why" is missing - why is necessary to handle `function' as a macro? I think it's to inhibit the processing of `function' as function somewhere else, but where and why? I think you explained it, at least partly, in an earlier post on this thread. > >> > If cl--labels-convert-cache is being used > >> > inside the byte compiler, it surely needs to consider # >> > 42> and # as eq? > >> No, it should not treat them equal (when it does, it introduces an > >> incorrect sympos and can thus lead to error messages pointing at the > >> wrong place). > > Then isn't what is wrong here the introduction of the incorrect SWP > > rather than treating the two SWPs as EQ? > I can't see how to separate one from the other here: the introduction of > the incorrect SWP is due to treating the two SWP as `eq`. > > This is obscure, difficult code. :-( > Agreed. > > We should think about committing a fix to the original bug, > > sometime, too. > I'm not completely sure we agree yet on what is "the original bug", but > obviously I agree with your sentence :-) I meant bug #65017. I committed a fix for it yesterday using the patch I posted here on Sunday, and closed the bug. > Stefan -- Alan Mackenzie (Nuremberg, Germany).