unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Difference Between REPL and Script Usage?
@ 2011-01-29 17:38 Noah Lavine
  2011-01-30 12:21 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Noah Lavine @ 2011-01-29 17:38 UTC (permalink / raw)
  To: guile-devel

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



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

* Re: Difference Between REPL and Script Usage?
  2011-01-29 17:38 Difference Between REPL and Script Usage? Noah Lavine
@ 2011-01-30 12:21 ` Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2011-01-30 12:21 UTC (permalink / raw)
  To: Noah Lavine; +Cc: guile-devel

On Sat 29 Jan 2011 18:38, Noah Lavine <noah.b.lavine@gmail.com> writes:

> ./check-guile peg.test
> ;;; 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

Here, this indicates that we are interpreting peg.scm.

> ERROR: Unbound variable: safe-bind-f

So somehow under interpretation, peg.scm relies on the value of
something that isn't defined yet.

BTW: when you submit your peg.scm patches, can you rebase them on top of
wip-mlucy?  That is mlucy's changes, but rebased onto a master of a few
days ago.

> But got an error. To see what was wrong, I opened guile and did
> "(use-modules (ice-9 peg))". That worked fine.

That probably auto-compiled peg.scm, then ran it.

> noah-lavines-macbook:guile noah$ ./check-guile peg.test

And now the test suite worked, as it was using the compiled peg.scm.

I think it's one of your standard eval-when style bugs.  Unfortunately
backtraces from interpreted code are currently terrible.

Regards,

Andy
-- 
http://wingolog.org/



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

end of thread, other threads:[~2011-01-30 12:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-29 17:38 Difference Between REPL and Script Usage? Noah Lavine
2011-01-30 12:21 ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).