Next: Compiler-only Implementation, Previous: Declarations, Up: Idiosyncrasies

#### 2.3.2 FASL Format

SBCL fasl-format is binary compatible only with the exact SBCL version it was generated with. While this is obviously suboptimal, it has proven more robust than trying to maintain fasl compatibility across versions: accidentally breaking things is far too easy, and can lead to hard to diagnose bugs.

The following snippet handles fasl recompilation automatically for ASDF-based systems, and makes a good candidate for inclusion in the user or system initialization file (see Initialization Files.)

         (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))))