Hello all, I have encountered a strange behavior in Guile, and I'm not sure what to do about it. It happened when I was trying to test peg.scm. I ran the test like this:
./check-guile peg.test Testing /Users/noah/Desktop/guile/guile/meta/guile ... peg.test with GUILE_LOAD_PATH=/Users/noah/Desktop/guile/guile/test-suite Running peg.test ;;; note: source file /Users/noah/Desktop/guile/guile/test-suite/tests/peg.test ;;; newer than compiled /Users/noah/Desktop/guile/guile/cache/guile/ccache/2.0-0.T-LE-8/Users/noah/Desktop/guile/guile/test-suite/tests/peg.test.go ;;; note: source file /Users/noah/Desktop/guile/guile/module/ice-9/peg.scm ;;; newer than compiled /Users/noah/Desktop/guile/guile/cache/guile/ccache/2.0-0.T-LE-8/Users/noah/Desktop/guile/guile/module/ice-9/peg.scm.go Backtrace: In ice-9/boot-9.scm: 2409: 19 [resolve-imports (((srfi srfi-1)) ((ice-9 pretty-print)) ((ice-9 peg)) ...)] 2340: 18 [resolve-interface (ice-9 peg) #:select ...] 2265: 17 [#<procedure 1012453a0 at ice-9/boot-9.scm:2253:4 (name #:optional autoload version #:key ensure)> # ...] 2531: 16 [try-module-autoload (ice-9 peg) #f] 1863: 15 [save-module-excursion #<procedure 101660a80 at ice-9/boot-9.scm:2532:17 ()>] 2542: 14 [#<procedure 101660a80 at ice-9/boot-9.scm:2532:17 ()>] In unknown file: ?: 13 [primitive-load-path "ice-9/peg" #f] In ice-9/eval.scm: 458: 12 [#<procedure 1010be240 at ice-9/eval.scm:452:4 (exp)> (eval-when # # # ...)] In ice-9/psyntax.scm: 908: 11 [chi-top-sequence (# # # # ...) () (#) ...] 1151: 10 [chi-top (define (cg-generic-ret accum name ...) (safe-bind # #)) () ...] 1508: 9 [chi-simple-lambda (# . #) () (()) ...] 1357: 8 [parse (((# # # # #) . #(syntax-object # # #))) () () () () () ()] 1007: 7 [syntax-type (safe-bind # #) (# # # # ...) (# # #) ...] 1304: 6 [chi-macro #<procedure 1016b9630 at ice-9/eval.scm:378:13 (a)> # # ...] In ice-9/eval.scm: 350: 5 [eval # #] 350: 4 [eval # #] 356: 3 [eval #<memoized safe-bind-f> (# # # # ...)] In unknown file: ?: 2 [memoize-variable-access! #<memoized safe-bind-f> #<directory # 101669cf0>] In ice-9/boot-9.scm: 115: 1 [#<procedure 1012cc9b0 at ice-9/boot-9.scm:110:6 (thrown-k . args)> unbound-variable ...] In unknown file: ?: 0 [catch-closure unbound-variable #f "Unbound variable: ~S" (safe-bind-f) #f] ERROR: In procedure catch-closure: ERROR: Unbound variable: safe-bind-f But got an error. To see what was wrong, I opened guile and did "(use-modules (ice-9 peg))". That worked fine. So I closed my guile interpreter and ran the test again. This time it worked. noah-lavines-macbook:guile noah$ ./check-guile peg.test Testing /Users/noah/Desktop/guile/guile/meta/guile ... peg.test with GUILE_LOAD_PATH=/Users/noah/Desktop/guile/guile/test-suite Running peg.test ;;; note: source file /Users/noah/Desktop/guile/guile/test-suite/tests/peg.test ;;; newer than compiled /Users/noah/Desktop/guile/guile/cache/guile/ccache/2.0-0.T-LE-8/Users/noah/Desktop/guile/guile/test-suite/tests/peg.test.go Totals for this test run: passes: 21 failures: 0 unexpected passes: 0 expected failures: 0 unresolved test cases: 0 untested test cases: 0 unsupported test cases: 0 errors: 0 So it looks like somehow loading things in the repl acts differently than loading them when Guile is a script interpreter. I'm not sure why this happened, but the behavior seems quite bad. Noah