On 1/5/06, michael graffam <[EMAIL PROTECTED]> wrote:
>
> Could someone help me with the use of *debugger-hook*
> ? I read the CLHS, but am somewhat confused.
>
> I have a function, call it foo, which grabs text from
> the user (via a GUI textbox), reads it with
> read-from-string, and evals it.
>
> (eval (read-from-string (ltk:textbox my.textbox)))
>
> I want to use *debugger-hook* to insulate my users
> from trouble.
You want to insulate your users from trouble, but *debugger-hook* is
probably not the easiest way to do so.
[...]
> On error, I'd
> like to simply inform the user that there is a
> problem, print the condition, clear the textbox, and
> allow the user to re-enter their code and continue.
It may be that the error-handling facilities that ship with Ltk are
able to do what you want to do; the support for this is currently in
flux, as the next release will have a new, better, supported api for
this. Ask on the Ltk list if you want more details.
I suspect that the right tool for the job is ignore-errors:
(multiple-value-bind (val error?)
(ignore-errors (eval foo))
(if error?
...
...))