If I fire up gsi, I can do:
(+ 1 (+ 2 'a))
*** ERROR IN (console)@3.6 -- (Argument 2) NUMBER expected (+ 2 'a) 1> ,(c 3) 4
$ cat test.scm: (eval '(+ 1 (+ 2 'a)))
$ gsi test.scm *** ERROR -- (Argument 2) NUMBER expected (+ 2 'a) $
okay ... so gsi dies on me, I look into main.scm (in the gambit source, this repl-debug function looks like what I wnat)
$ cat test2.scm cat test2.scm (define (my-eval x) (with-exception-catcher ##repl-debug (lambda () (pp x) (eval x))))
(pp (my-eval '(+ 1 (+ 2 'a))))
$ gsi test2.scm (+ 1 (+ 2 'a))
,(c 3)
3 $
I dislike this for two reasons. 1) I miss the error statement of: *** ERROR -- (Argument 2) NUMBER expected and 2) I get 3 instead of 4.
How can i correct these two? I suspect this is likely a 2 line fix since the functionality already exists.
thanks!
Afficher les réponses par date
On 27-Jan-09, at 3:44 PM, symbolic expression wrote:
$ cat test.scm: (eval '(+ 1 (+ 2 'a)))
$ gsi test.scm *** ERROR -- (Argument 2) NUMBER expected (+ 2 'a) $
Use the -:dr runtime option (which starts a REPL when an exception is raised rather than terminating gsi):
% cat test.scm (pp (+ 1 (+ 2 'a))) % gsi test.scm *** ERROR IN "test.scm"@1.10 -- (Argument 2) NUMBER expected (+ 2 'a) % echo $? 70 % gsi -:dr test.scm *** ERROR IN "test.scm"@1.10 -- (Argument 2) NUMBER expected (+ 2 'a)
,(c 3)
4
Marc