~$ cat test.scm (define bleh 10)
(##namespace ("foo#")) (##include "~~lib/gambit#.scm") (define + 20) (define blah 20) (define bleh 20)
(##namespace (""))
(pp `(+ ,+)) (pp `(bleh ,bleh)) (pp `(blah ,blah))
; what's going on? ~$ gsi test.scm (+ 20) (bleh 10) *** ERROR IN "test.scm"@13.13 -- Unbound variable: blah
what happened? how did I just rebind + ? I thought it would only affect foo#+
furthermore, it also seems to have effect on varaibles like "angle"
Thanks!
Afficher les réponses par date
The issue you're seeing here happens because "~~lib/gambit#.scm" declares that `+' is part of the default namespace. You need to inform the interpreter that `+' should be part of the `foo#' namespace after you include the gambit header. There may be a better way than my example below; I'm a namespace novice myself.
(##namespace ("foo#")) (##include "~~lib/gambit#.scm") (##namespace ("foo#" + blah))
(define + 20) (define blah 20)
(##namespace (""))
(pp `(+ ,+)) (pp `(foo#+ ,foo#+)) (pp `(bleh ,bleh))
Hope this helps,
-Ben