bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13865: redefinition of +


From: Ian Price
Subject: bug#13865: redefinition of +
Date: Mon, 04 Mar 2013 14:24:26 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

address@hidden (Ludovic Court$(D+2(Bs) writes:

> close 13865
> tag 13865 notabug
> thanks
>
> Ian Price <address@hidden> skribis:
>
>> is pretty much what we want usually. And I'm inclined to say NOTABUG for
>> the repl when optimisation is turned on. However, in a script, this is a
>> bug IMO, since we shouldn't really be optimising + if our top-level
>> binding for + is not the builtin one, and we can certainly detect a
>> redefinition of + within a file.
>
> The REPL is different from a $B!H(Breal$B!I(B program.
>
> In a stand-alone file like this:
>
> (define (+ a b) (- a b))
> (pk (+ 1 1))
>
> You get the expected behavior, because top-level $B!F(Bdefine$B!G(B is 
> like
> $B!F(Bletrec*$B!G(B.
>
> So closing it as not-a-bug.  Let us know if you think of actions to be
> taken.

Er, screw the repl, but it happens in a script as well.

(define (foo) (+ 1 1))
(define (+ a b) (- a b))
(display (foo))
(display (+ 1 1))
(newline)

$ guile -s /tmp/file1.scm
;;; note: source file /tmp/file1.scm
;;;       newer than compiled 
/home/ian/.cache/guile/ccache/2.2-LE-4-3.1/tmp/file1.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /tmp/file1.scm
;;; compiled /home/ian/.cache/guile/ccache/2.2-LE-4-3.1/tmp/file1.scm.go
22

  (letrec* ((foo (lambda () (+ 1 1)))
          (+ (lambda (a b) (- a b))))
  (display (foo))
  (display (+ 1 1))
  (newline))
  
$ guile -s /tmp/file1.scm
;;; note: source file /tmp/file1.scm
;;;       newer than compiled 
/home/ian/.cache/guile/ccache/2.2-LE-4-3.1/tmp/file1.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /tmp/file1.scm
;;; compiled /home/ian/.cache/guile/ccache/2.2-LE-4-3.1/tmp/file1.scm.go
00

If top-level module define is supposed to be a letrec*, it certainly
isn't acting like one.

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"





reply via email to

[Prev in Thread] Current Thread [Next in Thread]