Re: added a recompile restart to ASDF

Christophe Rhodes <[email protected]> Sun, 06 Apr 2008 22:45:23 +0100
Newsgroups gmane.lisp.cclan.general
Message-ID <[email protected]>
Gary King <[email protected]> writes:

> This has been working for me... It adds a "try recompiling" restart to  
> the load operation. Are there issues I'm missing or would this be a  
> good thing to add...
>
> (defmethod perform :around ((o load-op) (c cl-source-file))
>    (let ((state :initial))
>      (loop until (or (eq state :success)
> 		    (eq state :failure)) do
> 	 (case state
> 	   (:recompiled
> 	    (setf state :failure)

I don't understand this line.

> 	    (call-next-method)
> 	    (setf state :success))
> 	   (:failed-load
> 	    (setf state :recompiled)
> 	    (perform (make-instance 'asdf:compile-op) c))
> 	   (t
> 	    (with-simple-restart
> 		(:try-recompiling "Recompile ~a and try loading it again"
> 				  (component-name c))

I think the restart should be named by a symbol in the asdf package
rather than one in the keyword package.  (A small point, but it might
theoretically matter to someone, and I think it's just better style.)

> 	      (setf state :failed-load)
> 	      (call-next-method)
> 	      (setf state :success)))))))

Cheers,

Christophe

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone