l...@gnu.org (Ludovic Court$(D+2(Bs) writes: > close 13865 > tag 13865 notabug > thanks > > Ian Price <ianpric...@googlemail.com> 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"