[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scl:ignore-errors behavior in 7.2



   Date: Thu, 31 Oct 91 17:03:27 PST
   From: starnet!bass!lakin@apple.com (Fred Lakin)

   Does not seem to return multiple values in case of no error;

That's correct.  I believe it's documented to return the first value of the
body and a second value of NIL.

   and if there is an error, the second value is T, not the
   error condition.

I don't have my documentation here, but I think it's simply documented to
return non-NIL when there's an error, not specifically the error object
(IGNORE-ERRORS predates the condition system).

   Is there a way I can achieve this functionality (short of
   rel 8).

It still behaves the way you describe in 8.1.  However,
future-common-lisp:ignore-errors in 8.1 does what you want.  Here's an
implementation that should work prior to this:

(defmacro ansi-ignore-errors (&body body)
  `(condition-case (e)
       (progn ,@body)
     (error (values nil e))))

Note the difference between this and the version that someone else posted.
That version contains (values (progn ,@body)), so it only returns one
value when no error occurs.  Mine solves both problems described above.