all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#411: 23.0.60; flet and byte-compilation
@ 2008-06-14 15:17 Michael Heerdegen
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Heerdegen @ 2008-06-14 15:17 UTC (permalink / raw)
  To: emacs-pretest-bug

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






^ permalink raw reply	[flat|nested] 12+ messages in thread
* bug#411: 23.0.60; flet and byte-compilation
@ 2008-09-15  8:04 Glenn Morris
  0 siblings, 0 replies; 12+ messages in thread
From: Glenn Morris @ 2008-09-15  8:04 UTC (permalink / raw)
  To: 411

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.






^ permalink raw reply	[flat|nested] 12+ messages in thread
* bug#411: 23.0.60; flet and byte-compilation
@ 2008-09-25  2:16 Chong Yidong
  2008-09-25 17:45 ` Richard M. Stallman
  0 siblings, 1 reply; 12+ messages in thread
From: Chong Yidong @ 2008-09-25  2:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 411

Glenn Morris <rgm@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?






^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-10-31 16:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-14 15:17 bug#411: 23.0.60; flet and byte-compilation Michael Heerdegen
  -- strict thread matches above, loose matches on Subject: below --
2008-09-15  8:04 Glenn Morris
2008-09-25  2:16 Chong Yidong
2008-09-25 17:45 ` Richard M. Stallman
2008-09-26 18:48   ` Glenn Morris
2008-10-20  1:05     ` Glenn Morris
2008-10-23  2:41       ` Glenn Morris
2012-10-31  3:56         ` Glenn Morris
2012-10-31 13:58           ` Stefan Monnier
2012-10-31 15:01             ` Drew Adams
2012-10-31 16:06               ` Stefan Monnier
2012-10-31 16:13                 ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.