Re: (warn) isn't doing what I expect it to



Wade Humeniuk wrote:
Nathan Baum wrote:

I'm expecting

  (handler-case
      (warn "foo")
    (warning (c) (muffle-warning c)))

to produce no output, successfully. Instead it produces

  *** - INVOKE-RESTART: No restart named MUFFLE-WARNING is visible.

CLHS says WARN establishes a MUFFLE-WARNING restart. What am I doing wrong?


By the time the warning handler is called the stack is already unwound.
(There is no muffle-warning restart).
You need to use handler-bind instead.  With handler-bind the handler
is called without unwinding the current stack.

CL-USER 1 > (handler-bind
                ((warning (lambda (c)
                            (muffle-warning c))))
              (warn "foo"))
NIL


That's just great, thanks. :) .



Relevant Pages

  • Re: Perplexing Problem - Need Help
    ... I'd wager if a stack is being popped incorrectly, ... support for the scanner? ... before the call to the Assembly routine. ... have a pretty standard error handler, the error handler should be entered ...
    (microsoft.public.vb.general.discussion)
  • Re: Exception Handling...
    ... >>The try key word results in the current stack frame base, ... > private data on top of the Exception Registration... ... is the address of the exception handler. ... >>Immediately following this jump, there is inserted a jump to ...
    (comp.lang.pascal.delphi.misc)
  • Re: Fw: Re: [PATCH 1/3] signal(i386): alternative signal stack wraparound occurs
    ... detect when it would itself be causing a stack overflow. ... When it's the handler function itself or its callees that cause the ... signal stack based on the value of the SP at the time of a signal. ...
    (Linux-Kernel)
  • Re: patches for kForth signals interface
    ... If a Forth word is installed as a signal handler, when the OS executes the handler, the stack state is in an unpredictable condition, i.e. the switch may have occured during the middle of execution of a word. ... \ Test for stack overwrite problem in kForth 1.3.1 signals interface, ...
    (comp.lang.forth)
  • Re: VLA failure
    ... (with help from several comp.std.c regulars) ... ago, loosely based on setjmp/longjmp: ... Behavior is undefined if there is a stack exception in the function ... Why does __stackjmp_restoreset a default handler instead of no ...
    (comp.std.c)