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

Issue: UNWIND-PROTECT-CLEANUP-NON-LOCAL-EXIT (Version 4)



>	  (loop
>	    (catch 'foo
>	      (unwind-protect 
>		    (Run-application-evaluator)
>		(throw 'foo t))))
>
>  That's right! It WOULD serve as a barrier that no one can go past. But
>  did it occur to you that someone might want that? 

Although the following isn't a general solution, in most such
instances you can identify the catch tags that concern you and put 
explicit catch's in to intercept them.  E.g., assuming you care about
LISP-TOP-LEVEL and EXIT-LISP, this works just about as effectively as
the loop above: 

	  (loop
            (catch 'EXIT-LISP
  	      (catch 'LISP-TOP-LEVEL 
	        (Run-application-evaluator))))

Given a primitive that returned the currently active catch tags, you
could dynamically create the proper set of nested catch forms to
intercept all of them, modulo the usual lossage due to precisely timed
interrupts.

Given primitives to modify active catch frames, even fancier games
would be possible, although I don't see any obvious realistic uses.

Regarding JonL's phrase that "THROW commits", I read it to mean people
at Lucid had chosen that option, not that it was accepted as revealed
truth.  Also, I think naive English usage would expand "X commits to
Y" into something like "X will make whatever efforts of which it is
capable that are necessary to induce Y.  Thus we should assume Y will
occur, even though there might be unanticipated (e.g., force majeure)
situations which would obviate X's efforts."  In the context of this
discussion, unwind-protects are obviously anticipated and part of the
contract, as opposed to power failures, memory lossage, etc.

[I don't remember being part of the discussion JonL alluded to, so
 this is also something of an "outsiders" view of his analysis.]

 jlm