While experimenting with gambit's gsi (4.6.6), I ran into an odd situation when I typed in something invalid inside let.
Doing it the normal way, everything is as expected. i and
j are not visible.
> (let ((i 4) (j 3)) (display (+ i j)) (newline))
7
> i
*** ERROR IN (console)@2.1 -- Unbound variable: i
1> j
*** ERROR IN (console)@3.1 -- Unbound variable: j
However, if I flub up in the let block, i and
j are visible. It's almost as if I'm still inside the scope of the let form. Is that what's going on? Also, looking at the numbers on the prompt e.g. >
1> `2> etc. It looks like there's information there as well. If so, what is that? Maybe something related to nesting or an error mode?
2> (let ((i 2) (j 3)) (display + i j) (newline))
*** ERROR IN (console)@4.20 -- Wrong number of arguments passed to procedure
(display '#<procedure #2 +> 2 3)
3> i
2
3> j
3
This is a little different than in clojure. e.g.
user=> (defn display [n] (print n))
#'user/one-arg-function
user=> (let [i 2 j 3] (display + i j) (println))
ArityException Wrong number of args (3) passed to: user$one-arg-function clojure.lang.AFn.throwArity (AFn.java:437)
user=> i
CompilerException java.lang.RuntimeException: Unable to resolve symbol: i in this context, compiling:(NO_SOURCE_PATH:0)
user=> j
CompilerException java.lang.RuntimeException: Unable to resolve symbol: j in this context, compiling:(NO_SOURCE_PATH:0)