[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: toplevel-loop example
- To: djskrien@COLBY.EDU (Dale Skrien)
- Subject: Re: toplevel-loop example
- From: email@example.com (Bill St. Clair)
- Date: Fri, 31 Jul 1992 12:36:26 -0500
- Cc: info-mcl
>On page 654 in the MCL 2.0 final manual, I am told that you want your
>toplevel function to catch aborts if you don't want the listener to appear
>with an error message. Then the manual gives an example that shows what
>goes wrong if you don't catch aborts:
>? (defun new-top (&aux form)
> (setq form (read))
> (if (eq form 'done)
> (%set-toplevel #'toplevel-loop)
> (print (eval form))))
>? (%set-toplevel #'new-top)
>At this point, if you type a command-period, you are supposed to get an
>message saying that it can't throw to tag :abort.
>However, when I tried this, and typed a command-period, nothing happened.
>The new-top function just ignored the command-period. Is the manual
>correct? If so, why didn't I get the error message?
The manual is incorrect. There is an abort handler that is always active
that throws to a catch in the kernel which calls the toplevel function.
No error message.
>Can someone give me a simple modification of the above example that catches
>aborts, brings up a message dialog with an error message, and then returns
>to the top-level function?
Time to re-read the Conditions chapter of CLtL2?
(defun new-top ()
:report (lambda (stream)
"Pop up message dialog then return to toplevel."))
(message-dialog "Top-level loop aborted"))))
(defun new-top-internal (&aux form)
(setq form (read))
(if (eq form 'done)
(print (eval form))))