GNU bug report logs - #411
23.0.60; flet and byte-compilation

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: michael_heerdegen <at> web.de; dated Sat, 14 Jun 2008 15:25:06 UTC; Maintainer for emacs is bug-gnu-emacs <at> gnu.org.
Severity set to `wishlist' from `normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-13.3 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER,
	RCVD_IN_DNSWL_MED,VALID_BTS_CONTROL,X_DEBBUGS_NO_ACK autolearn=ham
	version=3.2.3-bugs.debian.org_2005_01_02
Received: (at 411) by emacsbugs.donarmstrong.com; 23 Oct 2008 02:44:15 +0000
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9N2i74j027780;
	Wed, 22 Oct 2008 19:44:08 -0700
Received: from rgm by fencepost.gnu.org with local (Exim 4.67)
	(envelope-from <rgm <at> gnu.org>)
	id 1Ksq8a-000081-V1; Wed, 22 Oct 2008 22:41:24 -0400
From: Glenn Morris <rgm <at> gnu.org>
To: 411 <at> debbugs.gnu.org
Cc: Chong Yidong <cyd <at> stupidchicken.com>, rms <at> gnu.org
Subject: Re: bug#411: 23.0.60; flet and byte-compilation
References: <87wsh1x95k.fsf <at> cyd.mit.edu> <E1KiuuR-0004K2-2X <at> fencepost.gnu.org>
	<wbiqsig2up.fsf <at> fencepost.gnu.org> <f8vdvocbz8.fsf <at> fencepost.gnu.org>
X-Spook: cybercash Lexis-Nexis cryptographic Bletchley Park
X-Ran: sZ)Qn`E_b6p&$^VM5,}|6&#8S(Z <at> S^>U4n>!J0k3teH.&'vt=>P0EHgQt-=9'ez*>rehC<
X-Hue: magenta
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Wed, 22 Oct 2008 22:41:24 -0400
Message-ID: <23ej28dodn.fsf <at> fencepost.gnu.org>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

severity 411 wishlist
stop

Well, I can't make it work, so I have made such things throw an error
when byte-compiled. I am leaving making it work open as a wishlist item.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#411; Package emacs. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-12.3 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER,
	RCVD_IN_DNSWL_MED,X_DEBBUGS_NO_ACK autolearn=ham
	version=3.2.3-bugs.debian.org_2005_01_02
Received: (at 411) by emacsbugs.donarmstrong.com; 20 Oct 2008 01:08:13 +0000
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9K18A0X028333
	for <411 <at> emacsbugs.donarmstrong.com>; Sun, 19 Oct 2008 18:08:11 -0700
Received: from rgm by fencepost.gnu.org with local (Exim 4.67)
	(envelope-from <rgm <at> gnu.org>)
	id 1KrjD9-0001Xt-Fj; Sun, 19 Oct 2008 21:05:31 -0400
From: Glenn Morris <rgm <at> gnu.org>
To: 411 <at> debbugs.gnu.org
Cc: rms <at> gnu.org, Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: bug#411: 23.0.60; flet and byte-compilation
References: <87wsh1x95k.fsf <at> cyd.mit.edu> <E1KiuuR-0004K2-2X <at> fencepost.gnu.org>
	<wbiqsig2up.fsf <at> fencepost.gnu.org>
X-Spook: BRLO bemd IMF computer terrorism diwn War on Terrorism
X-Ran: DQ"]dNokqgl(XdkIKV#`mxAZb}4OC(T?LN*6?VtsS(xSkJ-A_(~aM~JyfeY{tf1[wY"7Tp
X-Hue: blue
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Sun, 19 Oct 2008 21:05:31 -0400
In-Reply-To: <wbiqsig2up.fsf <at> fencepost.gnu.org> (Glenn Morris's message of
	"Fri, 26 Sep 2008 14:48:46 -0400")
Message-ID: <f8vdvocbz8.fsf <at> fencepost.gnu.org>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

Glenn Morris wrote:

> Perhaps flet need a byte-compiler handler that looks at the functions
> being bound in the flet, and temporarily (while the flet body is being
> compiled) removes any special byte-compile properties they might have.

The problem with this is that there doesn't seem to be a way to
specify byte-compile handlers for macros (except macros at top-level).
The compile functions always just call `macroexpand' before doing
anything else.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#411; Package emacs. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-12.1 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER,
	RCVD_IN_DNSWL_MED,X_DEBBUGS_NO_ACK autolearn=ham
	version=3.2.3-bugs.debian.org_2005_01_02
Received: (at 411) by emacsbugs.donarmstrong.com; 26 Sep 2008 18:50:58 +0000
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8QIotVF007380
	for <411 <at> emacsbugs.donarmstrong.com>; Fri, 26 Sep 2008 11:50:56 -0700
Received: from rgm by fencepost.gnu.org with local (Exim 4.67)
	(envelope-from <rgm <at> gnu.org>)
	id 1KjIMw-0005bw-89; Fri, 26 Sep 2008 14:48:46 -0400
From: Glenn Morris <rgm <at> gnu.org>
To: rms <at> gnu.org
Cc: 411 <at> debbugs.gnu.org, Chong Yidong <cyd <at> stupidchicken.com>
Subject: Re: bug#411: 23.0.60; flet and byte-compilation
References: <87wsh1x95k.fsf <at> cyd.mit.edu> <E1KiuuR-0004K2-2X <at> fencepost.gnu.org>
X-Spook: Lon Horiuchi ANC pipeline high security CID Kennedy
X-Ran: (?HhP7wDR:Q`QBk=alD[}UFj2^I_EN0&HzH`K>2i0'hSgAnh:%<*|XQQk:?dp}MvLKaO|l
X-Hue: cyan
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Fri, 26 Sep 2008 14:48:46 -0400
Message-ID: <wbiqsig2up.fsf <at> fencepost.gnu.org>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

"Richard M. Stallman" wrote:

> One possible way to fix it is to make the byte compiler check
> that the function has a subr definition as usual.

When I tried to do this naively in byte-compile-associative, it did
not work, because the compiler does not evaluate the (fset '+ ...)
redefinition at compile-time.

Perhaps flet need a byte-compiler handler that looks at the functions
being bound in the flet, and temporarily (while the flet body is being
compiled) removes any special byte-compile properties they might have.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#411; Package emacs. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-9.8 required=4.0 tests=AWL,BAYES_00,FOURLA,
	HAS_BUG_NUMBER,RCVD_IN_DNSWL_MED autolearn=ham
	version=3.2.3-bugs.debian.org_2005_01_02
Received: (at 411) by emacsbugs.donarmstrong.com; 25 Sep 2008 17:47:58 +0000
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8PHlsBu022522
	for <411 <at> emacsbugs.donarmstrong.com>; Thu, 25 Sep 2008 10:47:55 -0700
Received: from rms by fencepost.gnu.org with local (Exim 4.67)
	(envelope-from <rms <at> gnu.org>)
	id 1KiuuR-0004K2-2X; Thu, 25 Sep 2008 13:45:47 -0400
Content-Type: text/plain; charset=ISO-8859-15
From: "Richard M. Stallman" <rms <at> gnu.org>
To: Chong Yidong <cyd <at> stupidchicken.com>, 411 <at> debbugs.gnu.org
CC: monnier <at> iro.umontreal.ca
In-reply-to: <87wsh1x95k.fsf <at> cyd.mit.edu> (message from Chong Yidong on Wed,
	24 Sep 2008 22:16:07 -0400)
Subject: Re: bug#411: 23.0.60; flet and byte-compilation
Reply-to: rms <at> gnu.org
References:  <87wsh1x95k.fsf <at> cyd.mit.edu>
Message-Id: <E1KiuuR-0004K2-2X <at> fencepost.gnu.org>
Date: Thu, 25 Sep 2008 13:45:47 -0400

    > I guess byte-compile-associative mangles the '(+ x y) form without
    > regard for the redefinition in effect. I don't know if that is
    > fixable, or should be a documented caveat with regards to primitives.

    I don't see how to fix this, and my inclination is to just document this
    limitation in the docstring of `flet'.  Stefan, WDYT?

I am not sure if it is worth fixing, but one possible way
One possible way to fix it is to make the byte compiler check
that the function has a subr definition as usual.






Acknowledgement sent to rms <at> gnu.org:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text available.
Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#411; Package emacs. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-5.3 required=4.0 tests=AWL,BAYES_00,FOURLA,
	HAS_BUG_NUMBER autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02
Received: (at 411) by emacsbugs.donarmstrong.com; 25 Sep 2008 02:15:41 +0000
Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8P2Fcqd016722
	for <411 <at> emacsbugs.donarmstrong.com>; Wed, 24 Sep 2008 19:15:40 -0700
Received: by cyd.mit.edu (Postfix, from userid 1000)
	id EECF657E189; Wed, 24 Sep 2008 22:16:07 -0400 (EDT)
From: Chong Yidong <cyd <at> stupidchicken.com>
To: Stefan Monnier  <monnier <at> iro.umontreal.ca>
Cc: Glenn Morris <rgm <at> gnu.org>, 411 <at> debbugs.gnu.org
Subject: Re: bug#411: 23.0.60; flet and byte-compilation
Date: Wed, 24 Sep 2008 22:16:07 -0400
Message-ID: <87wsh1x95k.fsf <at> cyd.mit.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

Glenn Morris <rgm <at> gnu.org> wrote:

> > (defun f (x y)
> >   (flet ((+ (a b) (- a b)))
> >     (+ x y)))
> > 
> > Bytecompile it [...]
> > 
> > Evaluate the expression (f 1 2). This should yield -1, but the result
> > will be 3.
>
> it works to comment out the line in bytecomp.el
>
> (byte-defop-compiler (+ byte-plus)  byte-compile-associative)
>
> I guess byte-compile-associative mangles the '(+ x y) form without
> regard for the redefinition in effect. I don't know if that is
> fixable, or should be a documented caveat with regards to primitives.

I don't see how to fix this, and my inclination is to just document this
limitation in the docstring of `flet'.  Stefan, WDYT?




Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text available.
Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#411; Package emacs. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-11.1 required=4.0 tests=AWL,BAYES_00,FAKE_REPLY_C,
	HAS_BUG_NUMBER,RCVD_IN_DNSWL_MED,X_DEBBUGS_NO_ACK autolearn=ham
	version=3.2.3-bugs.debian.org_2005_01_02
Received: (at 411) by emacsbugs.donarmstrong.com; 15 Sep 2008 08:06:59 +0000
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8F86rn4015733
	for <411 <at> emacsbugs.donarmstrong.com>; Mon, 15 Sep 2008 01:06:54 -0700
Received: from rgm by fencepost.gnu.org with local (Exim 4.67)
	(envelope-from <rgm <at> gnu.org>)
	id 1Kf94s-0002Sm-9h; Mon, 15 Sep 2008 04:04:58 -0400
From: Glenn Morris <rgm <at> gnu.org>
To: 411 <at> debbugs.gnu.org
Subject: Re: bug#411: 23.0.60; flet and byte-compilation
X-Spook: quarter munitions Noriega benelux freedom wire transfer
X-Ran: d1!Uo;=4v?b<|N*NEp5&WU.)cZ7lz}<r,',ENWea*n3Tx3!ukL+Yl6r{3=HSEVmQJPo/=1
X-Hue: blue
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Mon, 15 Sep 2008 04:04:58 -0400
Message-ID: <kny71tq1g5.fsf <at> fencepost.gnu.org>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

Michael Heerdegen wrote:

> (defun f (x y)
>   (flet ((+ (a b) (- a b)))
>     (+ x y)))
> 
> Bytecompile it [...]
> 
> Evaluate the expression (f 1 2). This should yield -1, but the result
> will be 3.

Some (much delayed) observations:

1) it works to use `labels' instead of `flet'

2) it works to comment out the line in bytecomp.el

(byte-defop-compiler (+ byte-plus)  byte-compile-associative)

I guess byte-compile-associative mangles the '(+ x y) form without
regard for the redefinition in effect. I don't know if that is
fixable, or should be a documented caveat with regards to primitives.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#411; Package emacs. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-7.9 required=4.0 tests=BAYES_00,FOURLA,
	RCVD_IN_DNSWL_MED autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02
Received: (at submit) by emacsbugs.donarmstrong.com; 14 Jun 2008 15:17:46 +0000
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m5EFHgtU000483
	for <submit <at> emacsbugs.donarmstrong.com>; Sat, 14 Jun 2008 08:17:43 -0700
Received: from mail.gnu.org ([199.232.76.166]:55216 helo=mx10.gnu.org)
	by fencepost.gnu.org with esmtp (Exim 4.67)
	(envelope-from <Michael_Heerdegen <at> web.de>)
	id 1K7XTb-0008ON-7K
	for emacs-pretest-bug <at> gnu.org; Sat, 14 Jun 2008 11:15:35 -0400
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60)
	(envelope-from <Michael_Heerdegen <at> web.de>)
	id 1K7XUr-0004ZC-Cr
	for emacs-pretest-bug <at> gnu.org; Sat, 14 Jun 2008 11:17:39 -0400
Received: from fmmailgate01.web.de ([217.72.192.221]:54728)
	by monty-python.gnu.org with esmtp (Exim 4.60)
	(envelope-from <Michael_Heerdegen <at> web.de>)
	id 1K7XUq-0004Yt-TK
	for emacs-pretest-bug <at> gnu.org; Sat, 14 Jun 2008 11:16:53 -0400
Received: from smtp08.web.de (fmsmtp08.dlan.cinetic.de [172.20.5.216])
	by fmmailgate01.web.de (Postfix) with ESMTP id DB776E40A79A
	for <emacs-pretest-bug <at> gnu.org>; Sat, 14 Jun 2008 17:16:50 +0200 (CEST)
Received: from [217.185.137.231] (helo=debian)
	by smtp08.web.de with asmtp (WEB.DE 4.109 #226)
	id 1K7XUo-0003Vj-00
	for emacs-pretest-bug <at> gnu.org; Sat, 14 Jun 2008 17:16:50 +0200
From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.60; flet and byte-compilation
Reply-to: michael_heerdegen <at> web.de
Date: Sat, 14 Jun 2008 17:17:12 +0200
Message-Id: <1213456632.0 <at> debian>
Sender: Michael_Heerdegen <at> web.de
X-Sender: michael_heerdegen <at> web.de
X-Provags-ID: V01U2FsdGVkX1+8Relu/gbvJX9LItDm41TT/AcRslPLaf/QHE0V
	56q+7ANzLRsZ+GND5AhAAg51A56t8KrBtsmPJot8MhYZmI93eZ
	HURIF4oOqoRQek5UbqsA==
X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6

A much simplified version of the original problem, but still a bug:

Create a file test.el with the following contents:

(defun f (x y)
  (flet ((+ (a b) (- a b)))
    (+ x y)))

Bytecompile it and load f.elc.

Evaluate the expression (f 1 2). This should yield -1, but the result
will be 3.



In GNU Emacs 23.0.60.2 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2008-05-17 on debian
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: C
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Help

Minor modes in effect:
  hl-line-mode: t
  minibuffer-indicate-depth-mode: t
  shell-dirtrack-mode: t
  display-time-mode: t
  msb-mode: t
  mouse-sel-mode: t
  icomplete-mode: t
  show-paren-mode: t
  recentf-mode: t
  auto-image-file-mode: t
  partial-completion-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  view-mode: t




Acknowledgement sent to michael_heerdegen <at> web.de:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text available.
Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#411; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 20 Sep 2011 19:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.