Hi Lispers!
I research sources ASDF Library. I am not understand: Why repeat the compilation of a file (below code and details)?
(defmethod perform-with-restarts ((o compile-op) (c cl-source-file)) (loop :with state = :initial :until (or (eq state :success) (eq state :failure)) :do (case state (:recompiled (setf state :failure) (call-next-method) (setf state :success)) (:failed-compile (setf state :recompiled) (perform-with-restarts o c)) (t (with-simple-restart (try-recompiling "Try recompiling ~a" (component-name c)) (setf state :failed-compile) (call-next-method) (setf state :success))))))
This is bad for me: my code evaluated twice (eval-when (:compile-toplevel) ...) in a file that i am recompiled throghout select try-recompiling restart.
Details. 1. (setf state :failed-compiled) 2. error compilation. 3. select try-recompiling restart. 4. next iteration. 5. (setf state :recompiled) 6. recursive call: (perform-with-restarts o c) (in recusive-call) 6.1 (setf state :failed-compile) 6.2 (call-next-method) = success compile 6.3 (setf state :success) 6.4 next iteration and exit call. 7. next iteration 8. (setf state :failure) 9. (call-next-method) - second compilation! ???
I understand that (call-next-method) conceptual feature. But the file should not compile twice! Suggestions?
2011/10/5 Сергей Катревич linkfly1@newmail.ru:
Hi Lispers!
Привет Sergey!
I research sources ASDF Library. I am not understand: Why repeat the compilation of a file (below code and details)?
Probably a bug. Those retry state machines date from before my time, and though I tried not to touch them, they may have been slightly buggy then, or I may have broken them when I took over.
However, I admit I didn't quite understand your description of events. Could you just retry your failure while you (trace asdf::perform asdf::perform-with-restarts compile-file asdf::make-sub-operation) and maybe insert format statements to print the state of the state variable everytime it has been modified?
Alternatively, if someone who is not afraid of headaches can give a look at the state machines in "perform-with-restarts", I'll be glad.
Thanks!
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
I rewrote the perform-with-restarts methods based on what I understand they *should* be doing, and without any of the state machine complication that I never quite got the hang of.
Can you tell me if ASDF works better for you with the attached patch? I passes all self-tests for me (on SBCL), but I admit I haven't tried hard to trigger the case. If it works for you, I'll commit it.
I don't suppose anyone wants to write a test case for that. Sigh. So I may have to myself write a file that includes a state machine for compile-time and/or load-time failure. Yay defvar and eval-when...
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org