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

go and return-from inside unwind-protect cleanup



    Date: Mon, 9 Sep 85 13:01 EDT
    From: Guy Steele <gls@THINK-AQUINAS.ARPA>

	Date: Mon, 9 Sep 85 09:43 EDT
	From: David C. Plummer in disguise <DCP@SCRC-QUABBIN.ARPA>

	Are the following legal?

		(defun foo (go-p)
		  (prog nil
		     tag
			(unwind-protect
			    (return (compute))
			  (if go-p (go tag)))))

		(defun bar (return-p)
		  (prog nil
		     tag
			(unwind-protect
			    (progn (compute)
				   (go tag))
			  (if return-p (return nil)))))

    I regard both of these as completely legal.

While they may be legal and implementable, I feel that this programming
style should be strongly discouraged.  For one thing, it can be
rather difficult to stop the execution of (FOO T), since any attempt
to THROW out of it will simply cause it to re-enter its infinite loop.