Previous: Unix-style Command Line Protocol, Up: Initialization Examples


2.4.4.2 Automatic Recompilation of Stale Fasls

SBCL fasl-format is at current stage of development undergoing non-backwards compatible changes fairly often. The following snippet handles recompilation automatically for ASDF-based systems.

     (require :asdf)
     
     ;;; If a fasl was stale, try to recompile and load (once).
     (defmethod asdf:perform :around ((o asdf:load-op)
                                      (c asdf:cl-source-file))
        (handler-case (call-next-method o c)
           ;; If a fasl was stale, try to recompile and load (once).
           (sb-ext:invalid-fasl ()
              (asdf:perform (make-instance 'asdf:compile-op) c)
              (call-next-method))))