:around methods on LOAD-OP and COMPILE-OP

"Nikodemus Siivola" <[email protected]> Wed, 30 Jul 2008 11:14:39 +0300
Newsgroups gmane.lisp.cclan.general
Message-ID <[email protected]>
These two are a relatively recent addition:

(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)
            (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))
              (setf state :failed-load)
              (call-next-method)
              (setf state :success)))))))

(defmethod perform :around ((o compile-op) (c cl-source-file))
  (let ((state :initial))
    (loop 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 (make-instance 'asdf:compile-op) c))
           (t
            (with-simple-restart
                (:try-recompiling "Try recompiling ~a"
                                  (component-name c))
              (setf state :failed-compile)
              (call-next-method)
              (setf state :success)))))))

from about 3 months ago. Sorry for not noticing this earlier, but they
stop in the middle of one of the nicer places for users to hook into
global ASDF behaviour:

(defmethod asdf:perform :around ((op asdf:load-op) (c asdf:cl-source-file))
  (handler-case
      (call-next-method)
    (sb-ext:invalid-fasl ()
      (asdf:perform (make-instance 'asdf:compile-op) c)
      (call-next-method))))

...or perhaps rather, such user tweaks stomp on the TRY-RECOMPILING
restarts. Maybe they could be hung on (unexported) BASIC-LOAD-OP and
(to be added) BASIC-COMPILE-OP instead, so that users can still do
their thing without nuking bits of the official ASDF?

Cheers,

 -- Nikodemus


I don't have a really clean solution yet, but one option would be to
inject an unexpo

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/