From: Jeff Dalton
Subject: Re: errset for Lucid?
Date: 
Message-ID: <409@aiva.ed.ac.uk>
In article <···@woozle.cs.bham.ac.uk> ···@cs.bham.ac.uk (Ian G Batten <BattenIG>) writes:
>
>I'm surprised to learn that Lucid Common Lisp appears to have no
>equivalent of the MacLisp "errset" --- ie "don't invoke the debugger on
>on a error, just return WHATEVER HAPPENS".

As you know, Common Lisp the Language does not define any error handling.
But since x3j13 is planning to define an error system, some Common Lisp
implementations may have decided to wait rather than provide something that
might turn out to be incompatible.  I would expect them to provide Kent
Pitman's poposed system once it progresses a bit further, perhaps after
the next x3j13 meeting in June.

>Does anyone have any suggestions?  I'm open to RTFM, as long as I'm told
>which FM to R; I see nothing in the two Sun Manuals and CLtL says this
>is all implementation-defined.

I too could not find anything in the documentation, or even among the
symbols in the LUCID or SYSTEM packages.  However, errors signalled by
Lucid do seem to use the ERROR and CERROR functions rather than some
mysterious internal routines (Lucid is generally good that way), which
suggests that refdefining them would accomplish something.

I wrote some code, given below, that has worked in all cases I've tried
so far.  Rather than write ERRSET exactly, I wrote IGNORE-ERRORS, which
is the nearest equivalent of ERRSET in the x3j13 proposal.

The code isn't meant to be a proper solution to your problem but may
nonetheleess be helpful.


IGNORE-ERRORS &rest forms					[Macro]

IGNORE-ERRORS evaluates the forms.  If no error is signalled during those
evaluations, IGNORE-ERRORS returns the values returned by the last form.
Otherwise, it returns two values: NIL and the signalled error.

The second value is meant to be a condition object, but here it just
returns a list containing ERROR or CERROR and then the arguments with
which ERROR or CERROR was called.


;;; Error Hack for Lucid CL

;;; Jeff Dalton, AIAI/PSG, University of Edinburgh

(setf (symbol-function 'saved-error) #'error)
(setf (symbol-function 'saved-cerror) #'cerror)
(setf (symbol-function 'saved-break) #'break)

(defun enable-ignore-errors ()
  (setf (symbol-function 'error) (symbol-function 'new-error))
  (setf (symbol-function 'cerror) (symbol-function 'new-cerror))
  (setf (symbol-function 'break) (symbol-function 'new-break))
  :enabled)

(defun disable-ignore-errors ()
  (setf (symbol-function 'error) (symbol-function 'saved-error))
  (setf (symbol-function 'cerror) (symbol-function 'saved-cerror))
  (setf (symbol-function 'break) (symbol-function 'saved-break))
  :disabled)

(defvar *ignore-error-tag* 'nil)

(defmacro ignore-errors (&body forms)
  `(let ((*ignore-error-tag* (list '*ignore-error-tag*)))
     (catch *ignore-error-tag*
       ,@forms)))

(defun new-error (&rest args)
  (if *ignore-error-tag*
      (throw *ignore-error-tag*
	(values nil (cons 'error args)))
    (apply #'saved-error args)))

(defun new-cerror (&rest args)
  (if *ignore-error-tag*
      (throw *ignore-error-tag*
	(values nil (cons 'cerror args)))
    (apply #'saved-cerror args)))

(defun new-break (&rest args)
  ;; Break always enters the debugger and hides any ignore-errors.
  (let ((*ignore-error-tag* 'nil))
    (apply #'saved-break args)))


Jeff Dalton,                      JANET: ········@uk.ac.ed             
AI Applications Institute,        ARPA:  ·················@nss.cs.ucl.ac.uk
Edinburgh University.             UUCP:  ...!ukc!ed.ac.uk!J.Dalton

From: ·······@uiucdcsp.cs.uiuc.edu
Subject: Re: errset for Lucid?
Date: 
Message-ID: <80300007@uiucdcsp>
 The title of this note: "errset in Lucid" is most misleading, as the
 language Lucid (Hopcroft et al) is an independent entity in its own
 right. "Lucid CL" would have been preferable.
From: D Berry
Subject: Re: errset for Lucid?
Date: 
Message-ID: <1337@its63b.ed.ac.uk>
In article <········@uiucdcsp>  writes:
> The title of this note: "errset in Lucid" is most misleading, as the
> language Lucid (Hopcroft et al) is an independent entity in its own
		  ^^^^^^^^
		  Ashcroft

> right. "Lucid CL" would have been preferable.


-- 
"The answer is simple, they could do it with ease;
 stop attacking the patients, and attack the disease."	-- Tom Robinson.
From: Barry Margolin
Subject: Re: errset for Lucid?
Date: 
Message-ID: <20743@think.UUCP>
In article <········@uiucdcsp> ·······@uiucdcsp.cs.uiuc.edu writes:
> The title of this note: "errset in Lucid" is most misleading, as the
> language Lucid (Hopcroft et al) is an independent entity in its own
> right. "Lucid CL" would have been preferable.

This is the comp.lang.lisp newsgroup, whose purpose is the discussion
of Lisp, not languages in general (there's a comp.lang.misc for that).
In that context, I'll bet most readers understood the reference to
Lucid as Lucid Common Lisp.


Barry Margolin
Thinking Machines Corp.

······@think.com
uunet!think!barmar