How do you find where an error has occurred in MIT

2019-08-10 18:54发布

问题:

When you get an error in MIT scheme it doesn't tell you where the error occurred. For example, it just prints something like this:

;Unbound variable: top-left
;To continue, call RESTART with an option number:
; (RESTART 3) => Specify a value to use instead of top-left.
; (RESTART 2) => Define top-left to a given value.
; (RESTART 1) => Return to read-eval-print level 1.

How do I find where this error occurred in my code?

回答1:

In mit-scheme, if you are using the REPL from a shell, you can call debug to get the debugger. If you are using the edwin editor. It comes with it's own debugger. Edwin debug. Neither will tell you the line of code in a file where the error occurred if that is what you want. But they provide plenty of information, and facilities to find the problem. Both links are to the Documentation with a good explanation on how to use them.